weekdaze-0.0.0.1: A school-timetable problem-solver.

Safe HaskellSafe
LanguageHaskell2010

WeekDaze.Colour.RGB

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
Exports a representation of a colour as primary components.
Synopsis

Types

Data-types

data RGB primaryColour Source #

The representation of a colour as three primary components.

Instances
Functor RGB Source # 
Instance details

Defined in WeekDaze.Colour.RGB

Methods

fmap :: (a -> b) -> RGB a -> RGB b #

(<$) :: a -> RGB b -> RGB a #

Eq primaryColour => Eq (RGB primaryColour) Source # 
Instance details

Defined in WeekDaze.Colour.RGB

Methods

(==) :: RGB primaryColour -> RGB primaryColour -> Bool #

(/=) :: RGB primaryColour -> RGB primaryColour -> Bool #

Show primaryColour => Show (RGB primaryColour) Source # 
Instance details

Defined in WeekDaze.Colour.RGB

Methods

showsPrec :: Int -> RGB primaryColour -> ShowS #

show :: RGB primaryColour -> String #

showList :: [RGB primaryColour] -> ShowS #

Constants

black :: Num n => RGB n Source #

The constant representation of black in RGB.

white24Bit :: (Integral n, Show n) => RGB n Source #

The constant representation of white in RGB.

radix :: Integral i => i Source #

Constant base of number-system used to represent 24-bit colours in HTML.

Functions

absDifference :: Num n => RGB n -> RGB n -> RGB n Source #

Find the absolute difference between the matching component colours.

toTriple :: RGB a -> (a, a, a) Source #

Deconstructor.

Constructors

mkRGB Source #

Arguments

:: a

Red.

-> a

Green.

-> a

Blue.

-> RGB a 

Constructor.

mkRGB24Bit Source #

Arguments

:: (Integral a, Show a) 
=> a

Red.

-> a

Green.

-> a

Blue.

-> RGB a 

Smart-constructor.

fromIntegral' :: (Integral i, Show i) => i -> RGB i Source #

Represents the specified positive integral value as RGB 24-bit.

Operators

(>+<) :: Num n => RGB n -> RGB n -> RGB n infixl 6 Source #

  • Add the matching component colours.
  • CAVEAT: this may result in overflow.

Translation

toRGBUnitInterval :: (Integral i, Fractional f) => RGB i -> RGB f Source #

Convert RGB 24-bit to RGB UnitInterval, i.e. map from the closed interval [0,255] to the semi-closed interval [0,1).

fromRGBUnitInterval :: (Integral i, RealFrac f) => RGB f -> RGB i Source #

Convert RGB UnitInterval to RGB 24-bit, i.e. map from the semi-closed interval [0,1) to the closed interval [0,255].