Structs
A struct that represents the number of degrees in a circle.
Legal values range from
0-359
. Anything else is unused.A struct to represent how much hue, saturation, and luminosity should be added to create a color.
The hue is a degree on the color wheel; 0 (or 360) is red, 120 is green, 240 is blue.
A valid value for
h
must range between 0-360
.
The saturation ranges between 0-100
, where 0
is completely desaturated, and 100
is full saturation.
The luminosity ranges between 0-100
, where 0
is no light (black), and 100
is full light (white).A struct to represent how much hue, saturation, and luminosity should be added to create a color.
Also handles alpha specifications.
A struct to represent how much red, green, and blue should be added to create a color.
A struct to represent how much red, green, and blue should be added to create a color.
Also handles alpha specifications.
A struct that represents a ratio and determines the legal value(s) for a given type.
Clamps any values that fall beyond the valid legal range for the type.
Used to convert a type into a valid percentage representation.
Traits
A trait that can be used for converting between different color models
and performing various transformations on them.
Functions
Construct an angle from degrees. Angles outside of the 0-359° range will be
normalized accordingly.
Constructs a HSL Color from numerical values, similar to the
hsl
function in CSS.Constructs a HSLA Color from numerical values, similar to the
hsla
function in CSS.Construct an ratio from percentages. Values outside of the 0-100% range
will cause a panic.
Constructs a RGB Color from numerical values, similar to the
rgb
function in CSS.Constructs a RGB Color from numerical values, similar to the
rgba
function in CSS.