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

Safe HaskellSafe-Inferred

Graphics.Gloss.Data.Color

Contents

Description

Predefined and custom colors.

Synopsis

Color data type

data Color Source

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

makeColorSource

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].

makeColor' :: Float -> Float -> Float -> Float -> ColorSource

Make a custom color. You promise that all components are clamped to the range [0..1]

makeColor8Source

Arguments

:: Int

Red component.

-> Int

Green component.

-> Int

Blue component.

-> Int

Alpha component.

-> Color 

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

rawColorSource

Arguments

:: Float

Red component.

-> Float

Green component.

-> Float

Blue component.

-> Float

Alpha component.

-> Color 

Make a custom color. Components should be in the range [0..1] but this is not checked.

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

Take the RGBA components of a color.

Color functions

mixColorsSource

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 -> ColorSource

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

dim :: Color -> ColorSource

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

bright :: Color -> ColorSource

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

light :: Color -> ColorSource

Lighten a color, adding white.

dark :: Color -> ColorSource

Darken a color, adding black.

Pre-defined colors

greyNSource

Arguments

:: Float

Range is 0 = black, to 1 = white.

-> Color 

A greyness of a given magnitude.

Primary

Secondary

Tertiary