Module convert

Source
Expand description

cbindgen:ignore Color conversion algorithms.

Algorithms, matrices and constants are from the [color-4] specification, unless otherwise specified:

https://drafts.csswg.org/css-color-4/#color-conversion-code

NOTE: Matrices has to be transposed from the examples in the spec for use with the euclid library.

Structsยง

A98Rgb
The a98-rgb color space. https://drafts.csswg.org/css-color-4/#predefined-a98-rgb
DisplayP3
The Display-P3 color space. https://drafts.csswg.org/css-color-4/#predefined-display-p3
Hsl
Color specified with hue, saturation and lightness components.
Hwb
Color specified with hue, whiteness and blackness components.
Lab
The Lab color space. https://drafts.csswg.org/css-color-4/#specifying-lab-lch
Lch
The Lch color space. https://drafts.csswg.org/css-color-4/#specifying-lab-lch
Oklab
The Oklab color space. https://drafts.csswg.org/css-color-4/#specifying-oklab-oklch
Oklch
The Oklch color space. https://drafts.csswg.org/css-color-4/#specifying-oklab-oklch
ProphotoRgb
The ProPhoto RGB color space. https://drafts.csswg.org/css-color-4/#predefined-prophoto-rgb
Rec2020
The Rec.2020 color space. https://drafts.csswg.org/css-color-4/#predefined-rec2020
Srgb
The sRGB color space. https://drafts.csswg.org/css-color-4/#predefined-sRGB
SrgbLinear
The same as sRGB color space, except the transfer function is linear light. https://drafts.csswg.org/css-color-4/#predefined-sRGB-linear
XyzD50
A color in the XYZ coordinate space with a D50 white reference. https://drafts.csswg.org/css-color-4/#predefined-xyz
XyzD65
A color in the XYZ coordinate space with a D65 white reference. https://drafts.csswg.org/css-color-4/#predefined-xyz

Enumsยง

WhitePoint
A reference white that is used during color conversion.

Traitsยง

ColorSpaceConversion
A trait that allows conversion of color spaces to and from XYZ coordinate space with a specified white point.

Functionsยง

convert_white_point ๐Ÿ”’
epsilon_for_range
Calculate an epsilon for a specified range.
from_xyz
Convert the color components from XYZ at the given white point to the specified color space.
hsl_to_rgb
Convert from HSL notation to RGB notation. https://drafts.csswg.org/css-color-4/#hsl-to-rgb
hwb_to_rgb
Convert from HWB notation to RGB notation. https://drafts.csswg.org/css-color-4/#hwb-to-rgb
normalize_hue
Normalize hue into [0, 360).
orthogonal_to_polar
Convert from the rectangular orthogonal to the cylindrical polar coordinate system. This is used to convert (ok)lab to (ok)lch. https://drafts.csswg.org/css-color-4/#lab-to-lch
polar_to_orthogonal
Convert from the cylindrical polar to the rectangular orthogonal coordinate system. This is used to convert (ok)lch to (ok)lab. https://drafts.csswg.org/css-color-4/#lch-to-lab
rgb_to_hsl
Convert from RGB notation to HSL notation. https://drafts.csswg.org/css-color-4/#rgb-to-hsl
rgb_to_hue_min_max ๐Ÿ”’
Calculate the hue from RGB components and return it along with the min and max RGB values.
rgb_to_hwb
Convert from RGB notation to HWB notation. https://drafts.csswg.org/css-color-4/#rgb-to-hwb
to_xyz
Convert the color components from the specified color space to XYZ and return the components and the white point they are in.
transform ๐Ÿ”’
xyz_d50_to_xyz_d65 ๐Ÿ”’
xyz_d65_to_xyz_d50 ๐Ÿ”’

Type Aliasesยง

Transform ๐Ÿ”’
Vector ๐Ÿ”’