Copyright | (c) 2018 Jeffrey Rosenbluth |
---|---|
License | BSD-style (see LICENSE) |
Maintainer | jeffrey.rosenbluth@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Functions to create random colors. Includes a port of David Merfield's randomColor.
Synopsis
- randomCIELab :: MonadRandom m => m Kolor
- randomCIELabPalette :: MonadRandom m => m [Kolor]
- randomColor :: MonadRandom m => Hue -> Luminosity -> m Kolor
- randomPalette :: MonadRandom m => Hue -> Luminosity -> m [Kolor]
- randomHarmony :: MonadRandom m => Kolor -> m [Kolor]
- randomHue :: MonadRandom m => Hue -> m Int
- randomSaturation :: MonadRandom m => Hue -> Luminosity -> m Int
- randomBrightness :: MonadRandom m => Hue -> Luminosity -> Int -> m Int
A Library for generating random colors.
Choose a random color from CIELAB colorspace.
randomCIELab :: MonadRandom m => m Kolor Source #
Generate a random color from CIELAB (a perceptually uniform color space)
with a White point of d65
. Probably the best choice if you want a totally
random color.
randomCIELab
randomCIELabPalette :: MonadRandom m => m [Kolor] Source #
Generate a random color palette using randomCIELab
. First choose a
random color then choose a random harmony and apply it.
randomCIELabPalette
Choose a random color using David Merfield's algorithm
randomColor :: MonadRandom m => Hue -> Luminosity -> m Kolor Source #
Generate a random opaque color.
randomColor HueRed LumBright
randomColor HueOrange LumBright
randomColor HueYellow LumBright
randomColor HueGreen LumBright
randomColor HueBlue LumBright
randomColor HuePurple LumBright
randomColor HuePink LumBright
randomColor HueMonochrome LumRandom
randomColor HueRandom LumLight
randomColor HueRandom LumDark
randomColor HueRandom LumRandom
Better to use randomCIELab
for truly random colors.
randomPalette :: MonadRandom m => Hue -> Luminosity -> m [Kolor] Source #
Generate a random color palette. First choose a random color then choose a random harmony and apply it.
randomPalette
randomHarmony :: MonadRandom m => Kolor -> m [Kolor] Source #
Return a random harmony based on a seed color.
Choose a random HSV component
randomHue :: MonadRandom m => Hue -> m Int Source #
Return a random hue in the range $[lo, hi]$ as a Double
.
lo should be >= 0 and hi < 360.
Instead of storing red as two seperate ranges we create a single
contiguous range using negative numbers.
randomSaturation :: MonadRandom m => Hue -> Luminosity -> m Int Source #
randomBrightness :: MonadRandom m => Hue -> Luminosity -> Int -> m Int Source #
Pick a random brightness value given a Hue
, Luminosity
and saturation.