wumpus-core-0.15.0: Pure Haskell PostScript and SVG generation.

PortabilityGHC with TypeFamilies and more
Stabilityunstable
Maintainerstephen.tetley@gmail.com

Wumpus.Core.Colour

Contents

Description

RGB, HSB, Gray colour types, and conversions between them.

Internally Wumpus uses RGB3 Double with range [0.0, 1..0] as the colour type. All colour values in the generated SVG or PostScript files will be RGB.

Colour have Num instances for convenience, though the operations of Data.VectorSpace (instances also defined) seem more approriate.

Synopsis

Colour types

type DRGB = RGB3 DoubleSource

RGB representated by Double - values should be in the range 0.0 to 1.0.

  1. 0 represents full saturation, for instance red is 1.0, 0.0, 0.0.

type DHSB = HSB3 DoubleSource

HSB represented by Double - values should be in the range 0.0 to 1.0.

type DGray = Gray DoubleSource

Gray represented by a Double - values should be in the range 0.0 (black) to 1.0 (white).

Operations

rgb2hsb :: DRGB -> DHSBSource

Covert RGB [0,1] to HSB [0,1].

hsb2rgb :: DHSB -> DRGBSource

Covert HSB [0,1] to RGB [0,1].

rgb2gray :: DRGB -> DGraySource

Covert RGB [0,1] to Gray [0,1].

gray2rgb :: DGray -> DRGBSource

Covert Gray [0,1] to RGB [0,1].

hsb2gray :: DHSB -> DGraySource

Covert HSB [0,1] to Gray [0,1].

gray2hsb :: DGray -> DHSBSource

Covert Gray [0,1] to HSB [0,1].

Predefined colours

black :: DRGBSource

Black - 0.0, 0.0, 0.0.

white :: DRGBSource

White - 1.0, 1.0, 1.0.

red :: DRGBSource

Red - 1.0, 0.0, 0.0.

green :: DRGBSource

Green - 0.0, 1.0, 0.0.

blue :: DRGBSource

Blue - 0.0, 0.0, 1.0.