Converts linear components to sRGB components.
Converts sRGB components to linear components.
Converts linear components to sRGB hexadecimal.
Converts sRGB hexadecimal to linear components.
Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.
Common utilities for working with colors in vec3, vec4, or hexadecimal form.
Provides methods to convert linear components (vec3, vec4) to sRGB hex values. All colors in the glTF specification, excluding color textures, are linear. Hexadecimal values, in sRGB colorspace, are accessible through helper functions in the API as a convenience.
// Hex (sRGB) to factor (linear). const factor = ColorUtils.hexToFactor(0xFFCCCC, []); // Factor (linear) to hex (sRGB). const hex = ColorUtils.factorToHex([1, .25, .25])