caramia-0.7.2.2: High-level OpenGL bindings

Safe HaskellNone
LanguageHaskell2010

Graphics.Caramia.Color

Contents

Description

Color handling.

Synopsis

Types

data Color Source

The color data type.

This data type says nothing about the color space these values are in. The color space depends on the usage; for example, a framebuffer with sRGB textures attached uses sRGB color space in these color values.

Color's Storable instance is equal to V4 Float's Storable instance, in the order "r g b a".

Constructing colors

rgba :: Float -> Float -> Float -> Float -> Color Source

Construct a color from rgba values.

Conversion to Word8 colors.

floatToWord8 :: Float -> Word8 Source

A convenience function to turn a Float color value to a Word8.

The value is clamped between 0 and 255.

word8ToFloat :: Word8 -> Float Source

Maps a Word8 to a Float, so that 255 is mapped to 1.0 and 0 is mapped to 0.

Lenses

rgbaL :: Lens' Color (Float, Float, Float, Float) Source

Lens to all components.

redL :: Lens' Color Float Source

Lens to red component.

greenL :: Lens' Color Float Source

Lens to green component.

blueL :: Lens' Color Float Source

Lens to blue component.

alphaL :: Lens' Color Float Source

Lens to alpha component.

Views

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

View rgba in a tuple.