This page provides a short introduction to using the colour package on hackage.
The Colour data type
Colour a data type and its basic operations are found in the
Data.Colour module. The type variable
a is used to specify the numeric type used for the internal representation of the data. Typically one will use:
You may wish to make a type synonym for this type in your program if you will use it everywhere.
You can always use the
colourConvert to change to a different internal representation type.
A collections of colours given by name can be found in the
Data.Colour.Names module. There is also a
readColourName to convert a string with one of these names into a colour. Be aware that the colour
tan will conflict with the Prelude function unless you hide the Prelude function or import the module qualified.
Another way to make a colour is by specifying an RGB triple. These functions can be found in the
Data.Colour.SRGB library. For example, if you have three
sRGB24 red green blue
will create the colour with those sRGB colour coordinates.
If you have three
sRGB red green blue
will produce the colour with those colour coordinates. These
Double should be in the range [0,1] otherwise the resulting colour would be out of gamut (a colour gamut is a collection of representable colours on a device, such as your monitor).
sRGB24reads can create colour from string specifications of the form