GLSL vec3 to RGB
Multiply each component by 255 and round. Worth double-checking whether your vector is encoded or linear first.
rgb(66 135 245)Paste a GLSL vec3 value — other formats work too.
Need every format at once? Open in the full picker
Worked examples
Common colours converted from GLSL vec3 to RGB, computed with the same engine the picker uses.
| Colour | GLSL vec3 | RGB | Copy |
|---|---|---|---|
| Pure red | vec3(1.0, 0.0, 0.0) | rgb(255 0 0) | |
| Pure green | vec3(0.0, 1.0, 0.0) | rgb(0 255 0) | |
| Pure blue | vec3(0.0, 0.0, 1.0) | rgb(0 0 255) | |
| White | vec3(1.0) | rgb(255 255 255) | |
| Mid grey | vec3(0.502) | rgb(128 128 128) | |
| Black | vec3(0.0) | rgb(0 0 0) | |
| Interface blue | vec3(0.259, 0.529, 0.961) | rgb(66 135 245) | |
| Success green | vec3(0.133, 0.773, 0.369) | rgb(34 197 94) | |
| Danger red | vec3(0.937, 0.267, 0.267) | rgb(239 68 68) | |
| Warning amber | vec3(0.961, 0.62, 0.043) | rgb(245 158 11) | |
| Editor black | vec3(0.118) | rgb(30 30 30) | |
| Warm sand | vec3(0.914, 0.769, 0.416) | rgb(233 196 106) |
How the conversion works
Multiply each component by 255 and round. Worth double-checking whether your vector is encoded or linear first.
Both formats are computed from a single canonical representation — CIE XYZ with a D65 white point, held in floating point — rather than by chaining one format into the next. That matters because chained conversions accumulate rounding error, and because it means a colour that cannot be represented in the target format is handled deliberately rather than by accident.
When the source describes a colour outside the target's gamut, chroma is reduced in OKLCh while lightness and hue are held, following the CSS Color 4 gamut mapping algorithm. Clipping each channel independently would be simpler but visibly shifts hue on saturated colours.