Color

Back to PastelGfx

Color is the visual sensation caused by radiomagnetic radiation in the 400nm-700nm wavelength range.

Theory

Most humans have three kinds of receptors in the eye which are sensitive to different parts of the spectrum on sufficiently high intensities (daytime), and one additional receptor which is active only at low intensities (night-time). This gives rise to the trichromatic theory which states that the space of all different colors is 3-dimensional.

Practice

Pastel implements conversions between color spaces, conversions between integer-based color formats, and other useful tools for working with colors. Because of the trichromatic theory, a color is stored in objects of type Color, which is simply a 3-component vector of type real32. The color space is not enforced by the type system, so the user must keep in mind which color space a given color is from.

Learn more

Files

Color module

Color type

Color-mixer module

Testing for Color

Testing for lightness