colour-0.0.0: A colour model for human visionSource codeContentsIndex
Data.Colour
Description

Datatypes for representing the human perception of colour. Includes common operations for blending and compositing colours. The most common way of creating colours is either by name (see Data.Colour.Names) or by giving an sRGB triple (see Data.Colour.SRGB).

Methods of specifying Colours can be found in

Synopsis
data Colour a
colourConvert :: (Fractional b, Real a) => Colour a -> Colour b
data AlphaColour a
alphaColour :: Num a => Colour a -> AlphaColour a
fade :: Num a => a -> AlphaColour a -> AlphaColour a
withOpacity :: Num a => Colour a -> a -> AlphaColour a
transparent :: Num a => AlphaColour a
alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour b
alphaChannel :: AlphaColour a -> a
colourChannel :: Fractional a => AlphaColour a -> Colour a
class AffineSpace f where
affineCombo :: Num a => [(a, f a)] -> f a -> f a
blend :: (Num a, AffineSpace f) => a -> f a -> f a -> f a
class Composite f where
over :: Num a => AlphaColour a -> f a -> f a
compositeWith :: Num a => a -> Colour a -> Colour a -> Colour a
Documentation
data Colour a Source
This type represents the human preception of colour. The a parameter is a numeric type used internally for the representation.
show/hide Instances
colourConvert :: (Fractional b, Real a) => Colour a -> Colour bSource
Change the type used to represent the colour coordinates.
data AlphaColour a Source
This type represents a Colour that may be semi-transparent.
show/hide Instances
alphaColour :: Num a => Colour a -> AlphaColour aSource
Creates an opaque AlphaColour from a Colour.
fade :: Num a => a -> AlphaColour a -> AlphaColour aSource
Returns a AlphaColour more transparent by a factor of o.
withOpacity :: Num a => Colour a -> a -> AlphaColour aSource

Creates an AlphaColour from a Colour with a given opacity.

c `withOpacity` o == fade o (alphaColour c) 
transparent :: Num a => AlphaColour aSource
This AlphaColour is entirely transparent and has no associated colourChannel.
alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour bSource
Change the type used to represent the colour coordinates.
alphaChannel :: AlphaColour a -> aSource
Returns the opacity of an AlphaColour. This function is provided only for converting to other datatypes. Its use is discouraged. Instead compose the AlphaColour with another Colour and extract the resulting Colour components.
colourChannel :: Fractional a => AlphaColour a -> Colour aSource
Returns the colour of an AlphaColour. colourChannel transparent is undefined and may result in nan or an error. This function is provided only for converting to other datatypes. Its use is discouraged. Instead compose the AlphaColour with another Colour and extract the resulting Colour components.
class AffineSpace f whereSource
Methods
affineCombo :: Num a => [(a, f a)] -> f a -> f aSource

Compute a affine Combination (weighted-average) of points. The last parameter will get the remaining weight. e.g.

affineCombo [(0.2,a), (0.3,b)] c == 0.2*a + 0.3*b + 0.4*c
show/hide Instances
blend :: (Num a, AffineSpace f) => a -> f a -> f a -> f aSource

Compute the weighted average of two points. e.g.

blend 0.4 a b = 0.4*a + 0.6*b
class Composite f whereSource
Methods
over :: Num a => AlphaColour a -> f a -> f aSource
c1 `over` c2 returns the Colour created by compositing the AlphaColour c1 over c2, which may be either a Colour or AlphaColour.
show/hide Instances
compositeWith :: Num a => a -> Colour a -> Colour a -> Colour aSource
Composites c1 over c2 using opacity a.
Produced by Haddock version 2.6.0