Data.Colour.SRGB

colour-2.3.4: A model for human colour/color perception

Safe Haskell | Safe
Language | Haskell98

Data.Colour.SRGB

Description

Specifies `Colour`s in accordance with the sRGB standard.

Synopsis

- data Colour a
- data RGB a = RGB {
  - channelRed :: !a
  - channelGreen :: !a
  - channelBlue :: !a
  }
- sRGB24 :: (Ord b, Floating b) => Word8 -> Word8 -> Word8 -> Colour b
- sRGBBounded :: (Ord b, Floating b, Integral a, Bounded a) => a -> a -> a -> Colour b
- sRGB :: (Ord b, Floating b) => b -> b -> b -> Colour b
- toSRGB24 :: (RealFrac b, Floating b) => Colour b -> RGB Word8
- toSRGBBounded :: (RealFrac b, Floating b, Integral a, Bounded a) => Colour b -> RGB a
- toSRGB :: (Ord b, Floating b) => Colour b -> RGB b
- sRGB24shows :: (RealFrac b, Floating b) => Colour b -> ShowS
- sRGB24show :: (RealFrac b, Floating b) => Colour b -> String
- sRGB24reads :: (Ord b, Floating b) => ReadS (Colour b)
- sRGB24read :: (Ord b, Floating b) => String -> Colour b
- sRGBSpace :: (Ord a, Floating a) => RGBSpace a

# Documentation

data Colour a #

This type represents the human preception of colour. The `a` parameter is a numeric type used internally for the representation.

The `Monoid` instance allows one to add colours, but beware that adding colours can take you out of gamut. Consider using `blend` whenever possible.

Instances

ColourOps Colour # |
Instance details Defined in Data.Colour.Internal Methods over :: Num a => AlphaColour a -> Colour a -> Colour a # darken :: Num a => a -> Colour a -> Colour a #
AffineSpace Colour # |
Instance details Defined in Data.Colour.Internal Methods affineCombo :: Num a => [(a, Colour a)] -> Colour a -> Colour a #
Eq a => Eq (Colour a) # |
Instance details Defined in Data.Colour.Internal Methods (==) :: Colour a -> Colour a -> Bool # (/=) :: Colour a -> Colour a -> Bool #
(Fractional a, Read a) => Read (Colour a) # |
Instance details Defined in Data.Colour Methods readsPrec :: Int -> ReadS (Colour a) # readList :: ReadS [Colour a] # readPrec :: ReadPrec (Colour a) # readListPrec :: ReadPrec [Colour a] #
(Fractional a, Show a) => Show (Colour a) # |
Instance details Defined in Data.Colour Methods showsPrec :: Int -> Colour a -> ShowS # show :: Colour a -> String # showList :: [Colour a] -> ShowS #
Num a => Semigroup (Colour a) # |
Instance details Defined in Data.Colour.Internal Methods (<>) :: Colour a -> Colour a -> Colour a # sconcat :: NonEmpty (Colour a) -> Colour a # stimes :: Integral b => b -> Colour a -> Colour a #
Num a => Monoid (Colour a) # |
Instance details Defined in Data.Colour.Internal Methods mempty :: Colour a # mappend :: Colour a -> Colour a -> Colour a # mconcat :: [Colour a] -> Colour a #

data RGB a #

An RGB triple for an unspecified colour space.

Constructors

RGB |
Fields channelRed :: !a channelGreen :: !a channelBlue :: !a

Instances

Functor RGB # |
Instance details Defined in Data.Colour.RGB Methods fmap :: (a -> b) -> RGB a -> RGB b # (<$) :: a -> RGB b -> RGB a #
Applicative RGB # |
Instance details Defined in Data.Colour.RGB Methods pure :: a -> RGB a # (<*>) :: RGB (a -> b) -> RGB a -> RGB b # liftA2 :: (a -> b -> c) -> RGB a -> RGB b -> RGB c # (*>) :: RGB a -> RGB b -> RGB b # (<*) :: RGB a -> RGB b -> RGB a #
Eq a => Eq (RGB a) # |
Instance details Defined in Data.Colour.RGB Methods (==) :: RGB a -> RGB a -> Bool # (/=) :: RGB a -> RGB a -> Bool #
Read a => Read (RGB a) # |
Instance details Defined in Data.Colour.RGB Methods readsPrec :: Int -> ReadS (RGB a) # readList :: ReadS [RGB a] # readPrec :: ReadPrec (RGB a) # readListPrec :: ReadPrec [RGB a] #
Show a => Show (RGB a) # |
Instance details Defined in Data.Colour.RGB Methods showsPrec :: Int -> RGB a -> ShowS # show :: RGB a -> String # showList :: [RGB a] -> ShowS #

sRGB24 :: (Ord b, Floating b) => Word8 -> Word8 -> Word8 -> Colour b #

Construct a colour from a 24-bit (three 8-bit words) sRGB specification.

sRGBBounded :: (Ord b, Floating b, Integral a, Bounded a) => a -> a -> a -> Colour b #

Construct a colour from an sRGB specification. Input components are expected to be in the range [0..`maxBound`].

sRGB :: (Ord b, Floating b) => b -> b -> b -> Colour b #

Construct a colour from an sRGB specification. Input components are expected to be in the range [0..1].

toSRGB24 :: (RealFrac b, Floating b) => Colour b -> RGB Word8 #

Return the approximate 24-bit sRGB colour components as three 8-bit components. Out of range values are clamped.

toSRGBBounded :: (RealFrac b, Floating b, Integral a, Bounded a) => Colour b -> RGB a #

Return the approximate sRGB colour components in the range [0..`maxBound`]. Out of range values are clamped.

toSRGB :: (Ord b, Floating b) => Colour b -> RGB b #

Return the sRGB colour components in the range [0..1].

sRGB24shows :: (RealFrac b, Floating b) => Colour b -> ShowS #

Show a colour in hexadecimal form, e.g. "#00aaff"

sRGB24show :: (RealFrac b, Floating b) => Colour b -> String #

Show a colour in hexadecimal form, e.g. "#00aaff"

sRGB24reads :: (Ord b, Floating b) => ReadS (Colour b) #

Read a colour in hexadecimal form, e.g. "#00aaff" or "00aaff"

sRGB24read :: (Ord b, Floating b) => String -> Colour b #

Read a colour in hexadecimal form, e.g. "#00aaff" or "00aaff"

sRGBSpace :: (Ord a, Floating a) => RGBSpace a #

The sRGB colour space