7.7
Colors
(require colors) | package: colors |
1 Colors
the colors library provides alternatives to rgb color representations. it current supports hsl (hue, saturation, luminosity), hsi (hue, saturation, intensity), and hsv (hue, saturation, value).
For a full introduction to hsl and hsv color systems see Wikipedia.
2 structures and contracts
is it an hsl color type?
is it an hsi color type?
is it an hsv color type?
Contract which accepts any color like type: color%’s, strings, or h**/c values.
Contract for value hues. Equivalent to (or/c (real-in 0 1) +nan.0).
This contract is similar to %/c except +nan.0 is use for
colors which do not have a defined hue.
3 Color Construction
procedure
(color->hsl color) → hsl?
color : color/c
Convert to an HSL color.
procedure
(hsl->color hsl) → (is-a/c color%)
hsl : hsl?
Convert back to an RGB Color.
procedure
(color->hsv color) → hsv?
color : color/c
Convert to an HSV color.
procedure
(hsv->color hsv) → (is-a/c color%)
hsv : hsv?
Convert back to an RGB Color.
procedure
(color->hsi color) → hsi?
color : color/c
Convert to an HSI color.
procedure
(hsi->color hsi) → (is-a/c color%)
hsi : hsi?
Convert back to an RGB Color.
Directly construct an HSL color.
Directly construct an HSV color.
Directly construct an HSI color.
4 Color manipulation
procedure
(complement color) → h**/c
color : h**/c
Get the complement of a color. The resulting color has the same type as color.
Construct a color like color but with the given hue. The resulting color has the same type as color.
procedure
(set-saturation color saturation) → h**/c
color : h**/c saturation : %/c
Construct a color like color but with the given saturation. The resulting color has the same type as color.
procedure
(set-brightness color brightness) → h**/c
color : h**/c brightness : %/c
Construct a color like color but with the given brightness. The resulting color has the same type as color.