# Colors

## Colors [3.4]

Colors in OpenVG other than those stored in image pixels are represented as non-premultiplied sRGBA color values. Color and alpha values lie in the range [0, 1] unless otherwise noted.

### Linear color space [3.4.2]

The linear lRGB color space is defined in terms of the standard CIE XYZ color space, following ITU Rec. 709 using a D65 white point:

### sRGB color space [3.4.2]

The sRGB color space defines values Rs, Gs, Bs in terms of the linear lRGB primaries by applying a gamma mapping.

if

else

if

else

lRGB to sRGB conversion

sRGB to lRGB conversion

### Linear grayscale

The linear grayscale (luminance) color space is related to the linear lRGB color space by the equations:

The perceptually-uniform grayscale color space is related to the linear grayscale (luminance) color space by the mapping:

Conversion from perceptually-uniform grayscale to sRGB is performed by replication:

### Color space conversions

The following table summarizes the steps needed to convert one color space into another. The source format is in the left column, and the destination format is in the top row. The numbers indicate the equations from this section that are to be applied, in left-to-right order:

Src/Dst | lRGB | sRGB | lLUM | sLUM |
---|

lRGB | - | 1 | 3 | 3, 5 |

sRGB | 2 | - | 2, 3 | 2, 3, 5 |

lLUM | 4 | 4, 1 | - | 5 |

sLUM | 7, 2 | 7 | 6 | - |