Copyright | (C) 2013 Parnell Springmeyer |
---|---|
License | BSD3 |
Maintainer | Parnell Springmeyer <parnell@digitalmentat.com> |
Stability | stable |
Safe Haskell | Safe |
Language | Haskell2010 |
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.
- class BlendableColor c where
- class AdjustableColor c where
- class PresetColor c where
- module Data.Prizm.Color.CIE
- module Data.Prizm.Color.RGB
- module Data.Prizm.Types
Color Transformations
class BlendableColor c where Source #
A blendable color.
interpolate :: Percent -> (c, c) -> c Source #
Linear interpolation of a color with another color, applying a weight.
Blend two BlendableColor
colors using an interpolation weight
of 50%.
shade :: PresetColor c => c -> Percent -> c Source #
Shade a color by blending it using a weight and the
PresetColor
black.
tint :: PresetColor c => c -> Percent -> c Source #
Tint a color by blending it using a weight and the
PresetColor
white.
class AdjustableColor c where Source #
An adjustable color.
lightness :: c -> Percent -> c Source #
Adjust the lightness of a color
chroma :: 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 :: c -> Percent -> c Source #
Adjust the hue of a color
Preset Colors
class PresetColor c where Source #
Preset white and black for a color space.
Individual Color Spaces
CIE Color Space
module Data.Prizm.Color.CIE
RGB Color Space
module Data.Prizm.Color.RGB
Package Types (re-exports the individual color space type modules too)
module Data.Prizm.Types