Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utilities to manipulate colors, and setting them for Cairo drawings.
Synopsis
- type Color a = Colour a
- type AlphaColor a = AlphaColour a
- class CairoColor color where
- rgb :: Double -> Double -> Double -> Color Double
- hsv :: Double -> Double -> Double -> Color Double
- hsl :: Double -> Double -> Double -> Color Double
- rgba :: Double -> Double -> Double -> Double -> AlphaColor Double
- hsva :: Double -> Double -> Double -> Double -> AlphaColor Double
- hsla :: Double -> Double -> Double -> Double -> AlphaColor Double
- parseRgbaHex :: String -> AlphaColor Double
- parseRgbHex :: String -> Color Double
- data Colour a
- data AlphaColour a
- class AffineSpace (f :: Type -> Type) where
- affineCombo :: Num a => [(a, f a)] -> f a -> f a
- class ColourOps (f :: Type -> Type) where
- over :: Num a => AlphaColour a -> f a -> f a
- darken :: Num a => a -> f a -> f a
- colourConvert :: (Fractional b, Real a) => Colour a -> Colour b
- dissolve :: Num a => a -> AlphaColour a -> AlphaColour a
- alphaChannel :: AlphaColour a -> a
- withOpacity :: Num a => Colour a -> a -> AlphaColour a
- alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour b
- atop :: Fractional a => AlphaColour a -> AlphaColour a -> AlphaColour a
- blend :: (Num a, AffineSpace f) => a -> f a -> f a -> f a
- opaque :: Num a => Colour a -> AlphaColour a
- transparent :: Num a => AlphaColour a
- average :: [Color Double] -> Color Double
- black :: Num a => Colour a
- white :: (Ord a, Floating a) => Colour a
- adjustHsl :: (Double -> Double) -> (Double -> Double) -> (Double -> Double) -> Color Double -> Color Double
- adjustHsv :: (Double -> Double) -> (Double -> Double) -> (Double -> Double) -> Color Double -> Color Double
Documentation
type AlphaColor a = AlphaColour a Source #
American English type synonym
class CairoColor color where Source #
Anything we can instruct Cairo to set its color to.
Nothing
setColor :: color -> Render () Source #
>>>
:{
haddockRender "Draw/Color/set_color.svg" 140 40 $ \_ -> do for_ (zip [0..] [30, 40 .. 150-30]) $ \(i, x) -> do setColor (mma i) sketch (Circle (Vec2 x 20) 10) C.fill :} Generated file: size 4KB, crc32: 0xe0e16234
Instances
(Real a, Floating a) => CairoColor (AlphaColour a) Source # | |
Defined in Draw.Color setColor :: AlphaColour a -> Render () Source # setColour :: AlphaColour a -> Render () Source # | |
Real a => CairoColor (Colour a) Source # | |
Convert a color from sRGB space
Convert a color from HSV space
Convert a color from HSL space
:: Double | Red [0..1] |
-> Double | Green [0..1] |
-> Double | Blue [0..1] |
-> Double | Alpha [0..1] |
-> AlphaColor Double |
Convert a color from sRGBA space
:: Double | Hue [0..360] |
-> Double | Saturation [0..1] |
-> Double | Value (~ brightness) [0..1] |
-> Double | Alpha [0..1] |
-> AlphaColor Double |
Convert a color from HSVA space
:: Double | Hue [0..360] |
-> Double | Saturation [0..1] |
-> Double | Lightness [0..1] |
-> Double | Alpha [0..1] |
-> AlphaColor Double |
Convert a color from HSLA space
parseRgbaHex :: String -> AlphaColor Double Source #
Parse a RGBA hex value. error
s on bad input, so be careful!
parseRgbaHex
"0x123456ab"==
rgba
(fromIntegral
0x12255) (fromIntegral
0x34255) (fromIntegral
0x56255) (fromIntegral
0xab255)
parseRgbHex :: String -> Color Double Source #
Parse a RGB hex value. error
s on bad input, so be careful!
parseRgbHex
"0x123456"==
rgb
(fromIntegral
0x12255) (fromIntegral
0x34255) (fromIntegral
0x56/255)
data AlphaColour a #
Instances
class AffineSpace (f :: Type -> Type) where #
affineCombo :: Num a => [(a, f a)] -> f a -> f a #
Instances
AffineSpace AlphaColour | |
Defined in Data.Colour.Internal affineCombo :: Num a => [(a, AlphaColour a)] -> AlphaColour a -> AlphaColour a # | |
AffineSpace Colour | |
Defined in Data.Colour.Internal |
class ColourOps (f :: Type -> Type) where #
Instances
ColourOps AlphaColour | |
Defined in Data.Colour.Internal over :: Num a => AlphaColour a -> AlphaColour a -> AlphaColour a # darken :: Num a => a -> AlphaColour a -> AlphaColour a # | |
ColourOps Colour | |
colourConvert :: (Fractional b, Real a) => Colour a -> Colour b #
dissolve :: Num a => a -> AlphaColour a -> AlphaColour a #
alphaChannel :: AlphaColour a -> a #
withOpacity :: Num a => Colour a -> a -> AlphaColour a #
alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour b #
atop :: Fractional a => AlphaColour a -> AlphaColour a -> AlphaColour a #
blend :: (Num a, AffineSpace f) => a -> f a -> f a -> f a #
opaque :: Num a => Colour a -> AlphaColour a #
transparent :: Num a => AlphaColour a #