helm-0.7.0: A functionally reactive game engine.

Safe HaskellSafe-Inferred

FRP.Helm.Color

Contents

Description

Contains all data structures and functions for composing colors.

Synopsis

Types

data Color Source

A data structure describing a color. It is represented interally as an RGBA color, but the utility functions hsva, hsv, etc. can be used to convert from other popular formats to this structure.

Constructors

Color Double Double Double Double 

Instances

Eq Color 
Ord Color 
Read Color 
Show Color 
Generic Color 

data Gradient Source

A data structure describing a gradient. There are two types of gradients: radial and linear. Radial gradients are based on a set of colors transitioned over certain radii in an arc pattern. Linear gradients are a set of colors transitioned in a straight line.

Constructors

Linear (Double, Double) (Double, Double) [(Double, Color)] 
Radial (Double, Double) Double (Double, Double) Double [(Double, Color)] 

Instances

Eq Gradient 
Ord Gradient 
Read Gradient 
Show Gradient 

Composing

rgba :: Double -> Double -> Double -> Double -> ColorSource

Creates an RGB color, with transparency.

rgb :: Double -> Double -> Double -> ColorSource

Creates an RGB color.

hsva :: Double -> Double -> Double -> Double -> ColorSource

Create an RGBA color from HSVA values.

hsv :: Double -> Double -> Double -> ColorSource

Create an RGB color from HSV values.

blend :: [Color] -> ColorSource

Takes a list of colors and turns it into a single color by averaging the color components.

complement :: Color -> ColorSource

Calculate a complementary color for a provided color. Useful for outlining a filled shape in a color clearly distinguishable from the fill color.

linear :: (Double, Double) -> (Double, Double) -> [(Double, Color)] -> GradientSource

Creates a linear gradient. Takes a starting position, ending position and a list of color stops (which are colors combined with a floating value between 0.0 and 1.0 that describes at what step along the line between the starting position and ending position the paired color should be transitioned to).

 linear (0, 0) (100, 100) [(0, black), (1, white)]

The above example creates a gradient that starts at (0, 0) and ends at (100, 100). In other words, it's a diagonal gradient, transitioning from the top-left to the bottom-right. The provided color stops result in the gradient transitioning from black to white.

radial :: (Double, Double) -> Double -> (Double, Double) -> Double -> [(Double, Color)] -> GradientSource

Creates a radial gradient. Takes a starting position and radius, ending position and radius and a list of color stops. See the document for linear for more information on color stops.

Constants

red :: ColorSource

A bright red color.

lime :: ColorSource

A bright green color.

blue :: ColorSource

A bright blue color.

yellow :: ColorSource

A yellow color, made from combining red and green.

cyan :: ColorSource

A cyan color, combined from bright green and blue.

magenta :: ColorSource

A magenta color, combined from bright red and blue.

black :: ColorSource

A black color.

white :: ColorSource

A white color.

gray :: ColorSource

A gray color, exactly halfway between black and white.

grey :: ColorSource

Common alternative spelling of gray.

maroon :: ColorSource

A medium red color.

navy :: ColorSource

A medium blue color.

green :: ColorSource

A medium green color.

teal :: ColorSource

A teal color, combined from medium green and blue.

purple :: ColorSource

A purple color, combined from medium red and blue.

violet :: ColorSource

A violet color.

forestGreen :: ColorSource

A dark green color.