Safe Haskell | Safe-Inferred |
---|
Contains all data structures and functions for composing colors.
- data Color = Color {}
- data Gradient
- rgba :: Double -> Double -> Double -> Double -> Color
- rgb :: Double -> Double -> Double -> Color
- hsva :: Double -> Double -> Double -> Double -> Color
- hsv :: Double -> Double -> Double -> Color
- complement :: Color -> Color
- linear :: (Double, Double) -> (Double, Double) -> [(Double, Color)] -> Gradient
- radial :: (Double, Double) -> Double -> (Double, Double) -> Double -> [(Double, Color)] -> Gradient
- red :: Color
- lime :: Color
- blue :: Color
- yellow :: Color
- cyan :: Color
- magenta :: Color
- black :: Color
- white :: Color
- gray :: Color
- grey :: Color
- maroon :: Color
- navy :: Color
- green :: Color
- teal :: Color
- purple :: Color
- violet :: Color
- forestGreen :: Color
Types
A data structure describing a gradient. There are two types of gradients: radial and linear. Radial gradients are based on a set of colors transitioned over certain radii in an arc pattern. Linear gradients are a set of colors transitioned in a straight line.
Composing
complement :: Color -> ColorSource
Calculate a complementary color for a provided color. Useful for outlining a filled shape in a color clearly distinguishable from the fill color.
linear :: (Double, Double) -> (Double, Double) -> [(Double, Color)] -> GradientSource
Creates a linear gradient. Takes a starting position, ending position and a list of color stops (which are colors combined with a floating value between 0.0 and 1.0 that describes at what step along the line between the starting position and ending position the paired color should be transitioned to).
linear (0, 0) (100, 100) [(0, black), (1, white)]
The above example creates a gradient that starts at (0, 0) and ends at (100, 100). In other words, it's a diagonal gradient, transitioning from the top-left to the bottom-right. The provided color stops result in the gradient transitioning from black to white.
radial :: (Double, Double) -> Double -> (Double, Double) -> Double -> [(Double, Color)] -> GradientSource
Creates a radial gradient. Takes a starting position and radius, ending position and radius
and a list of color stops. See the document for linear
for more information on color stops.
Constants
A dark green color.