prizm-2.0.0: Convert colors to different color spaces, interpolate colors, and transform colors

Data.Prizm.Color

Description

Data.Prizm.Color exports all of the specific color space modules and types for blending colors, convenience blending (tint and shade), and adjusting the hue, lightness, or chroma of a given color. You should import this module.

Note that blending colors in a polar-coordinate color space, such as CIELCH, preserves the saturation and brightness of the colors being interpolated better than blending in RGB. It also turns out to be an effective even when converting from RGB to CIELCH, blending, then converting back again!

Here is an excellent blog post by someone discussing the differences: Improved Color Blending.

Synopsis

# Color Transformations

interpolate :: BlendableColor c => Percent -> (c, c) -> c Source #

Linear interpolation of a color with another color, applying a weight.

(<~>) :: BlendableColor c => c -> c -> c Source #

Blend two BlendableColor colors using an interpolation weight of 50%.

shade :: (BlendableColor c, PresetColor c) => c -> Percent -> c Source #

Shade a color by blending it using a weight and the PresetColor black.

tint :: (BlendableColor c, PresetColor c) => c -> Percent -> c Source #

Tint a color by blending it using a weight and the PresetColor white.

lightness :: AdjustableColor c => c -> Percent -> c Source #

Adjust the lightness of a color

chroma :: AdjustableColor c => c -> Percent -> c Source #

Adjust the chroma of a color

NB: not all color spaces will support this easily but it should be possible to convert into a color space that does then convert back

hue :: AdjustableColor c => c -> Percent -> c Source #

Adjust the hue of a color

# Preset Colors

white :: PresetColor c => c Source #

black :: PresetColor c => c Source #