Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Exports some colour-composition functions for HTML.
Synopsis
- unitIntervalToHTMLColourCode :: (RealFrac unitInterval, Show unitInterval) => unitInterval -> HTMLColourCode
- unitIntervalToRGB :: (Fractional alpha, Fractional unitInterval, Real alpha, Real unitInterval, Show alpha, Show unitInterval) => alpha -> alpha -> unitInterval -> unitInterval -> RGB unitInterval
- htmlColourCodeToRGB :: (Integral i, Show i) => HTMLColourCode -> RGB i
- rgbUnitIntervalToHTMLColourCode :: RealFrac unitInterval => RGB unitInterval -> HTMLColourCode
Functions
unitIntervalToHTMLColourCode :: (RealFrac unitInterval, Show unitInterval) => unitInterval -> HTMLColourCode Source #
- Calls
unitIntervalToRGB
, with default parameters to make 0 map to blue & 1 to red, & with a moderately high saturation. - Calls
rgbUnitIntervalToHTMLColourCode
to convert to an HTML colour-code.
:: (Fractional alpha, Fractional unitInterval, Real alpha, Real unitInterval, Show alpha, Show unitInterval) | |
=> alpha | The angular span in the range [0 .. 2 * pi radians], to which the unit-interval is mapped. |
-> alpha | The angular offset in radians. |
-> unitInterval | The saturation in the unit-interval; 0 will always result in black. |
-> unitInterval | The value in the unit-interval which is to be represented by a colour. |
-> RGB unitInterval |
- Maps the specified value from the unit-interval to the corresponding spectral colour represented as RGB.
- The mapping from the spectrum to RGB is performed by modeling the spectrum as a circular arc drawn on the colour triangle, of radius equal to the specified saturation, & centered on green. CAVEAT: this algorithm has no solid basis.
- One may specify the angular span & angular offset of this arc, to define the values to which 0 & 1 map.
Translation
htmlColourCodeToRGB :: (Integral i, Show i) => HTMLColourCode -> RGB i Source #
Represents the specified HTML colour-code as RGB 24-bit.
rgbUnitIntervalToHTMLColourCode Source #
:: RealFrac unitInterval | |
=> RGB unitInterval | Red, green & blue component-colours, each in the unit-interval. |
-> HTMLColourCode |
Represents the specified RGB as an HTML colour-code.