Crate scarlet [−] [src]
Scarlet is a library for making color, color spaces, and everything that comes with it simple to work with. The underlying philosophy is that if all you have is a hammer, everything looks like a nail: existing color libraries often only work with RGB or other convenient color spaces, and so go to great lengths to invent complicated workarounds for the essential problems with RGB and its ilk, namely not being very good analogues to the way humans actually see color. Scarlet makes working with color convenient enough that it's easier to treat colors correctly than it is to do anything else.
Modules
bound |
This module describes the Bound trait, which allows for a description of what colors a color gamut supports. For example, the sRGB gamut only supports RGB values ranging from 0-1 that are scaled to 0-255, which is about 30% of the total visible range of human vision. |
color |
This file defines the |
colormap |
This module defines a generalized trait for a colormap—a mapping of the numbers between 0 and 1 to colors in a continuous way—and provides some common ones used in programs like MATLAB and in data visualization everywhere. |
colorpoint |
This file implements most of the standard color functions that essentially work on 3D space,
including Euclidean distance, midpoints, and more. All of these methods work on |
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. |
coord |
This module contains a struct, [ |
illuminants |
This module provides an enum of various illuminants supported by Scarlet, as well as their white point values.The source for this table is from the ASTM E308 standard. The only one I could find available freely was the outdated E308-01 standard, but these values should be the same: they're both copied photographically from the CIE standard itself. These are normalized so that the Y (luminance) value is 100. |
material_colors |
This file provides some basic facilities for creating a Color object, specifically an RGBColor, from the Google Material design spec. |
prelude |
This module simply brings the most common Scarlet functionality under a single namespace, to
prevent excessive imports. As of now, this prelude includes every trait in Scarlet, the
ubiquitous [ |