Skip to content

srgb

Python reference for nagasim.appearance.srgb. Provisional: it may change between minor versions, see Appearance.

The sRGB channels of a colour #RRGGBB, each 0 to 1.

Every colour of a look is sRGB. A glTF base colour, and most renderers' shader inputs, are linear: pass the result to linear_rgb, as linear_rgb(srgb(c)).

Parameters:

Name Type Description Default
color str

A colour #RRGGBB.

required

Returns:

Type Description
tuple of float

(red, green, blue), still sRGB-encoded.

Raises:

Type Description
ValueError

When color is not a colour #RRGGBB.

See Also

nagasim.appearance.linear_rgb : The linear components a glTF base colour takes. nagasim.appearance.material : The material whose colour this reads.

Examples:

>>> from nagasim.appearance import srgb
>>> srgb("#FF8000")
(1.0, 0.5019607843137255, 0.0)