diagrams-contrib- Collection of user contributions to diagrams EDSL

Safe HaskellNone



Utilities for working with color in HSV space.

Right now, the only utility is a function for blending colors in HSV space. This has the effect of "travelling around the color wheel", which can be especially nice when one wants to blend smoothly from one color to another (blending in RGB space can tend to travel across some icky brown/grey colors).



hsvBlend :: (Floating a, RealFrac a, VectorSpace a) => Scalar a -> Colour a -> Colour a -> Colour aSource

Blend two colors in HSV space---that is, linearly interpolate between their hues, saturations, and values independently (wrapping around appropriately in the case of hue). In particular, hsvBlend a c1 c2 is like doing (a-1)*c1 + a*c2 in HSV space. That is, a parameter of 0 results in only the first color; 1 results in only the second color; and anything in between results in a blend.