[][src]Module scarlet::colors

This module contains various modules that implement types that implement Color. For convenience, each main type is imported into this module's namespace directly.

Re-exports

pub use self::adobergbcolor::AdobeRGBColor;
pub use self::cielabcolor::CIELABColor;
pub use self::cielchcolor::CIELCHColor;
pub use self::cielchuvcolor::CIELCHuvColor;
pub use self::cieluvcolor::CIELUVColor;
pub use self::hslcolor::HSLColor;
pub use self::hsvcolor::HSVColor;
pub use self::rommrgbcolor::ROMMRGBColor;

Modules

adobergbcolor

A module that implements the Adobe RGB color space. The Adobe RGB space differs greatly from sRGB: its components are floating points that range between 0 and 1, and it has a set of primaries designed to give it a wider coverage (over half of CIE 1931).

cielabcolor

A module that implements the CIELAB color space. The CIELAB color space is used as a device-independent color space that has an L value for luminance and two opponent color axes for chromaticity (loosely, hue). Formally, the three values that define a CIELAB color are called L*, A*, and B* to distinguish them from generic Lab, but for convenience they are just L, a, and b in this module.

cielchcolor

This file implements the CIELCH color space, a cylindrical transformation of CIELAB that uses chroma and hue instead of two opponent color axes. Be careful not to confuse this color with CIEHCL, which uses CIELUV internally.

cielchuvcolor

This module implements the CIELCHuv color space, a cylindrical transformation of the CIELUV space, akin to the relationship between CIELAB and CIELCH.

cieluvcolor

This module implements the CIELUV color specification, which was adopted concurrently with CIELAB. CIELUV is very similar to CIELAB, but with the difference that u and v are roughly equivalent to red and green and luminance is then used to calculate the blue part.

hslcolor

This file implements what I refer to as HSL but which would precisely be called sHSL: a simple transformation of sRGB that creates a cylindrical space. HSL has the same problems with perceptual uniformity and general unsuitability for exact psychophysically-accurate representation as color as sRGB does, but it does have the advantage of being easy to display on a monitor and having some conception of common color attributes. HSL and HSV are very similar but have an important difference: value in HSV runs from black to fully saturated colors, whereas lightness or luminosity in HSL runs from black to fully saturated in the middle to white at the end. This makes the saturation component of HSL extremely inaccurate, because light colors can have a very high saturation even if they are extremely close to white. This space is mathematically cylindrical, but when you account for the actual differentiation of colors (saturation's actual importance varies with lightness) it forms a "bi-hexcone" model, where the hue component is actually a hexagon but simply stretched into a circle, and the area of a horizontal cross-section varies with lightness. A special note: some implementations of HSV and HSL are circular in nature, using polar coordinates explicitly. This implementation is instead hexagonal: first values are put on a hexagon, and then that hexagon is "squeezed" into a circle. This can cause small variations between Scarlet and other applications. Another small implementation note is that converting gray into HSL or HSV will give a hue of 0 degrees, although any hue could be used in its place.

hsvcolor

This module implements the HSV color space, a cousin of the HSL color space. The definition of value differs from lightness: it goes from black to full saturation instead of black to white. This makes value an extraordinarily poor analog of luminance (dark purple is the same value as white, despite reflecting one-tenth the light), but does make the hue and saturation a bit more meaningful than HSL. The same caveat applies: this is a poor choice for getting actual color appearance parameters and is outclassed by CIELCH for that purpose, but it is nontheless important as the closest to such a space one can get using only basic transformations of RGB.

rommrgbcolor

This module implements the Romm, or ProPhoto, RGB space. Unlike other RGB gamuts, ProPhoto trades having some imaginary colors in its gamut (13% of it can't be seen) in exchange for a much wider gamut than other RGB spaces (90% of CIELAB surface colors).