Safe Haskell | Safe-Inferred |
---|
Predefined and custom colors.
- data Color
- makeColor :: Float -> Float -> Float -> Float -> Color
- makeColor' :: Float -> Float -> Float -> Float -> Color
- makeColor8 :: Int -> Int -> Int -> Int -> Color
- rawColor :: Float -> Float -> Float -> Float -> Color
- rgbaOfColor :: Color -> (Float, Float, Float, Float)
- mixColors :: Float -> Float -> Color -> Color -> Color
- addColors :: Color -> Color -> Color
- dim :: Color -> Color
- bright :: Color -> Color
- light :: Color -> Color
- dark :: Color -> Color
- greyN :: Float -> Color
- black :: Color
- white :: Color
- red :: Color
- green :: Color
- blue :: Color
- yellow :: Color
- cyan :: Color
- magenta :: Color
- rose :: Color
- violet :: Color
- azure :: Color
- aquamarine :: Color
- chartreuse :: Color
- orange :: Color
Color data type
An abstract color value.
We keep the type abstract so we can be sure that the components
are in the required range. To make a custom color use makeColor
.
:: Float | Red component. |
-> Float | Green component. |
-> Float | Blue component. |
-> Float | Alpha component. |
-> Color |
Make a custom color. All components are clamped to the range [0..1].
makeColor' :: Float -> Float -> Float -> Float -> ColorSource
Make a custom color. You promise that all components are clamped to the range [0..1]
Make a custom color. All components are clamped to the range [0..255].
:: Float | Red component. |
-> Float | Green component. |
-> Float | Blue component. |
-> Float | Alpha component. |
-> Color |
Make a custom color. Components should be in the range [0..1] but this is not checked.
Color functions
:: Float | Ratio of first color. |
-> Float | Ratio of second color. |
-> Color | First color. |
-> Color | Second color. |
-> Color | Resulting color. |
Mix two colors with the given ratios.
addColors :: Color -> Color -> ColorSource
Add RGB components of a color component-wise, then normalise them to the highest resulting one. The alpha components are averaged.