Skip to content

linear_rgb

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

sRGB channels to linear ones, as a glTF base colour takes them.

The colours of a look are sRGB #RRGGBB; a glTF baseColorFactor is linear_rgb(srgb(c)). Written by hand, so a renderer's embedded Python needs no numpy.

Parameters:

Name Type Description Default
rgb sequence of float

sRGB channels, each 0 to 1, as srgb gives them.

required

Returns:

Type Description
tuple of float

The same channels, linear.

See Also

nagasim.appearance.srgb : The sRGB components of a #RRGGBB colour.

Examples:

>>> from nagasim.appearance import linear_rgb, srgb
>>> [round(c, 4) for c in linear_rgb(srgb("#808080"))]
[0.2159, 0.2159, 0.2159]