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.
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 Color trait, the foundational defining trait of the entire
library. Despite the dizzying amount of things Color can do in Scarlet, especially with its
extending traits, the definition is quite simple: anything that can be converted to and from the
CIE 1931 XYZ space. This color space is
common to use as a master space, and Scarlet is no different. What makes XYZ unique is that it
can be computed directly from the spectral data of a color. Although Scarlet does not implement
this due to its scope, this property makes it possible to derive XYZ colors from real-world data,
something that no other color space can do the same way.
|
colormap | This module defines a generalized trait, ColorMap , 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
Color types that implement Into<Coord> and From<Coord> , and some
don't require From<Coord> . This makes it easy to provide these for custom
Color types.
|
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, Coord , that models a 3D coordinate space and supports limited
math in 3 dimensions with scalars and other coordinates. Used to unify math with colors that is
the same, just with different projections into 3D space.
|
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 2014 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 RGBColor , the associated parse error RGBParseError , the important
Illuminant , and nothing else. Of particular note is that any alternative color space found
in the colors module is not included. Additionally, the Material color enums and structs are
not present.
|