8.18.0.15
7.1 Color
| (require toolbox/color) | package: toolbox-draw-lib |
This module provides structures and functions useful when working with colors.
Note that, technically, none of the structures provided by this module (or the ones provided by racket/draw) represent colors, only color coordinates. The specific color referred to by a given set of color coordinates depends on the color space they are interpreted in.
procedure
red : (real-in 0 1) green : (real-in 0 1) blue : (real-in 0 1) alpha : (real-in 0 1) = 1.0
Example:
> (rgb 1 0 1 0.5) (rgb 1.0 0.0 1.0 0.5)
procedure
hue : rational? saturation : (real-in 0 1) value : (real-in 0 1) alpha : (real-in 0 1) = 1.0
Constructs an RGB color from the given HSV coordinates. The hue component represents an angle, where 0.0 is interpreted as 0° and 1.0 is interpreted as 360°. The value of hue may be any rational number, and it will be interpreted modulo 1.
Examples:
> (hsv 0 1 1) (rgb 1.0 0.0 0.0 1.0)
> (hsv 1/3 1 1) (rgb 0.0 1.0 0.0 1.0)
> (hsv 2/3 1 1) (rgb 0.0 0.0 1.0 1.0)
> (hsv 1/6 1 0.5) (rgb 0.5 0.5 0.0 1.0)
Returns the red component of an RGB color.
Returns the green component of an RGB color.
Returns the blue component of an RGB color.
Returns the alpha component of an RGB color.
Returns the hue component of the HSV coordinates for the given RGB color.
procedure
(rgb-saturation c) → (real-in 0 1)
c : rgb?
Returns the saturation component of the HSV coordinates for the given RGB color.
Returns the value component of the HSV coordinates for the given RGB color.
Equivalent to (values (rgb-hue v) (rgb-saturation v) (rgb-value v)), except that rgb->hsv can be more efficient.
Returns #t if #f is an RGB color, a color% object, or a string corresponding to a color name in the-color-database.
Returns an RGB color that represents the same color as c.
Returns an immutable color% object that represents the same color as c.