Retrieves alpha color channel from hex encoded color value.
The number encoded color value (representable as 0xRRGGBB or 0xTTRRGGBB in hex).
The floating point alpha component in <0, 1> range.
Encode and convert HSL value to number coded color format (0xRRGGBB).
Hue component value between 0 and 1.
Saturation value between 0 and 1.
Lightness channel between 0 and 1.
Encodes RGB all color channels in single number with format 0xRRGGBB.
All input channels should be in <0, 1> range (inclusively). See also getHexFromRgba for more information about [[THREE.Color]] compatibility.
Encodes RGBA channels in custom number coded format (represented in hex as 0xTTRRGGBB).
We do not use direct alpha channel mapping to hex in order to preserve compatibility with THREE.js color format (0xRRGGBB). This is done by encoding transparency (255 - alpha) instead of alpha on the oldest bits, shifted by [[SHIFT_TRANSPARENCY]]. This way simple 0xRRGGBB color is equal to 0x00RRGGBB without transparency and color defining transparency (alpha < 255) is always recognizable by the oldest bit set:
(color >> SHIFT_TRANSPARENCY) !== 0.
Retrieve RGBA channels separately from number encoded custom color format.
Provides an easy way for channels extraction (r, g, b, a) from custom number coded color format.
The number encoded color value (0xRRGGBB or 0xTTRRGGBB in hex).
r, g, b, a channels in simple object, where each channel value is saved as floating point from 0 to 1 inclusively.
Determines if number encoded color contains alpha (opacity) defined and different then 255.
The number encoded color (0xRRGGBB or 0xTTRRGGBB in hex).
True if color has transparency defined.
Remove transparency info from the number coded color, makes it compatible with external libs.
The number encoded color value (representable as 0xRRGGBB or 0xTTRRGGBB in hex).
number coded color value representable as 0xRRGGBB in hex.
Generated using TypeDoc
Utilities to convert RGBA colors encoded in custom number (hex) format to THREE.Color objects.
The functions provided allows for conversion from and to our custom number based color format, which contains transparency, red, green and blue color channels in a way that each channel occupies 8 bits of resulting number (color format 0xTTRRGGBB). In order to preserve compatibility with THREE.Color class and its hexadecimal color representation, we do not store alpha channel in encoded color's number, but replace it with transparency channel, which is simply opposite to alpha:
transparency = 0xFF - alpha
Such channel value is stored on the oldest bits (octet) in the integral color (numeric) value, so it is fully compatible with THREE.Color numerical representation (@see [[THREE.Color.getHex]], [[THREE.Color.setHex]]). See also getHexFromRgba and getRgbaFromHex for more info about conversion.