gloss-1.9.3.1: Painless 2D vector graphics, animations and simulations.

Safe Haskell | None
Language | Haskell98

Graphics.Gloss.Data.Color

Contents

- Color data type
- Color functions
- Pre-defined colors
  - Primary
  - Secondary
  - Tertiary

Description

Predefined and custom colors.

Synopsis

- data Color :: *
- makeColor :: Float -> Float -> Float -> Float -> Color
- makeColorI :: Int -> Int -> Int -> Int -> Color
- rgbaOfColor :: Color -> (Float, Float, Float, Float)
- mixColors :: Float -> Float -> Color -> Color -> Color
- addColors :: Color -> Color -> Color
- dim :: Color -> Color
- bright :: Color -> Color
- light :: Color -> Color
- dark :: Color -> Color
- greyN :: Float -> Color
- black :: Color
- white :: Color
- red :: Color
- green :: Color
- blue :: Color
- yellow :: Color
- cyan :: Color
- magenta :: Color
- rose :: Color
- violet :: Color
- azure :: Color
- aquamarine :: Color
- chartreuse :: Color
- orange :: Color

## Color data type

data Color :: *

An abstract color value. We keep the type abstract so we can be sure that the components are in the required range. To make a custom color use `makeColor`.

Instances

Eq Color |
Data Color |
Num Color |
Show Color |

makeColor

Arguments

:: Float | Red component.
-> Float | Green component.
-> Float | Blue component.
-> Float | Alpha component.
-> Color |

Make a custom color. All components are clamped to the range [0..1].

makeColorI :: Int -> Int -> Int -> Int -> Color

Make a custom color. All components are clamped to the range [0..255].

rgbaOfColor :: Color -> (Float, Float, Float, Float)

Take the RGBA components of a color.

## Color functions

mixColors Source

Arguments

:: Float | Ratio of first color.
-> Float | Ratio of second color.
-> Color | First color.
-> Color | Second color.
-> Color | Resulting color.

Mix two colors with the given ratios.

addColors :: Color -> Color -> Color Source

Add RGB components of a color component-wise, then normalise them to the highest resulting one. The alpha components are averaged.

dim :: Color -> Color Source

Make a dimmer version of a color, scaling towards black.

bright :: Color -> Color Source

Make a brighter version of a color, scaling towards white.

light :: Color -> Color Source

Lighten a color, adding white.

dark :: Color -> Color Source

Darken a color, adding black.

## Pre-defined colors

greyN Source

Arguments

:: Float | Range is 0 = black, to 1 = white.
-> Color |

A greyness of a given order.

black :: Color Source

white :: Color Source

### Primary

red :: Color Source

green :: Color Source

blue :: Color Source

### Secondary

yellow :: Color Source

cyan :: Color Source

magenta :: Color Source

### Tertiary

rose :: Color Source

violet :: Color Source

azure :: Color Source

aquamarine :: Color Source

chartreuse :: Color Source

orange :: Color Source