the-sett/elm-color/1.0.1

Color

This module provides a simple way of describing colors as RGB with alpha transparency, based on this simple data structure:

type alias Color =
    { red : Int, green : Int, blue : Int, alpha : Float }

The intention here is to provide a minimal and convenient representation of color for rendering purposes.

The color representations:

type alias Color =
{ red : Int
, green : Int
, blue : Int
, alpha : Float
}

A description of a color as computers see them.

Constructors:

rgb : Int -> Int -> Int -> Color

Builds an RGBA color from its RGB components at 100% opacity.

rgba : Int -> Int -> Int -> Float -> Color

Builds an RGBA color from all of its components.

hsl : Float -> Float -> Float -> Color

Builds and RGBA color from its hue, saturation and lighness (HSL) representation at 100% opacity.

hsla : Float -> Float -> Float -> Float -> Color

Builds and RGBA color from its hue, saturation, lighness and alpha (HSLA) representation.

grayscale : Float -> Color

Makes a grey level from 0 to 1.

greyscale : Float -> Color

Makes a grey level from 0 to 1.

complement : Color -> Color

Forms the complement of a color.

Color space conversion/extraction:

Color
-> { red : Int
, green : Int
, blue : Int
, alpha : Float
}

Converts the RGBA color to its RGBA representation - that is, does nothing.

Color
-> { hue : Float
, saturation : Float
, lightness : Float
, alpha : Float
}

Converts the RGBA color to its HSLA representation.

Some basic colors to get you started:

black : Color
blue : Color
brown : Color
charcoal : Color
darkBlue : Color
darkBrown : Color
darkCharcoal : Color
darkGray : Color
darkGreen : Color
darkGrey : Color
darkOrange : Color
darkPurple : Color
darkRed : Color
darkYellow : Color
gray : Color
green : Color
grey : Color
lightBlue : Color
lightBrown : Color
lightGray : Color
lightGreen : Color
lightGrey : Color
lightOrange : Color
lightPurple : Color
lightRed : Color
lightYellow : Color
orange : Color
purple : Color
red : Color
white : Color
yellow : Color