Liking cljdoc? Tell your friends :D
Clojure only.

clojure2d.color

Color functions.

This namespace contains color manipulation functions which can be divided into following groups:

  • Color creators
  • Channel manipulations
  • Conversions
  • Palettes / gradients
  • Distances

Representation

Color can be represented by following types:

  • fastmath Vec4 - this is core type representing 3 color channels and alpha (RGBA). Values are double type from [0-255] range. color, gray creators returns Vec4 representation.
  • fastmath Vec3 - 3 channels (RGB), assuming alpha set to value of 255.
  • fastmath Vec2 - gray with alpha
  • java.awt.Color - Java AWT representation. Creators are awt-color, awt-gray. Use to-awt-color to convert to this representation.
  • keyword - one of the defined names (see named-colors-list)
  • Integer - packed ARGB value. If value is less than 0xff000000, alpha is set to 0xff. Example: 0xffaa01.
  • String - CSS (#rgb or #rgba) or string containg hexadecimal representation ("ffaa01")
  • any seqable - list, vector containing 2-4 elements. Conversion is done by applying content to color function.

To create color from individual channel values use color function. To create gray for given intensity call gray.

By default color is treated as RGB with values from ranges [0.0-255.0] inclusive.

All funtions internally convert any color representation to Vec4 type using to-color function..

Coloured list of all names

Color/ channel manipulations

You can access individual channels by calling on of the following:

  • red or ch0 - to get first channel value.
  • green or ch1 - to get second channel value.
  • blue or ch2 - to get third channel value.
  • alpha - to get alpha value.
  • luma - to get luma or brightness (range from 0 (black) to 255 (white)).
  • hue - to get hue value in degrees (range from 0 to 360). Hexagon projection.
  • hue-polar - to get hue from polar transformation.

set-ch0, set-ch1, set-ch2 and set-alpha return new color with respective channel set to new value.

General set-channel and get-channel can work with any colorspace.

To make color darker/brighter use darken / [[lighten]] functions. Operations are done in Lab color space.

To change saturation call saturate / desaturate. Operations are done in LCH color space.

You can also modulate color (ie. multiply by given value).

Conversions

Color can be converted from RGB to other color space (and back). List of color spaces are listed under colorspaces-list variable. There are two types of conversions:

  • raw - with names to-XXX and from-XXX where XXX is color space name. Every color space has it's own value range for each channel. (comp from-XXX to-XXX) acts almost as identity.
  • normalized - with names to-XXX* and from-XXX* where XXX is color space name. to-XXX* returns values normalized to [0-255] range. from-XXX* expects also channel values in range [0-255].

NOTE: there is no information which color space is used. It's just a matter of your interpretation.

NOTE 2: be aware that converting function do not clamp any values to/from expected range.

Color space conversion functions are collected in two maps colorspaces for raw and colorspaces* for normalized functions. Keys are color space names as keyword and values are vectors with to- fn as first and from- fn as second element.

Palettes / gradients

Links

List of all defined colors and palettes:

Palette

Palette is just sequence of colors.

There are plenty of them predefined or can be generated:

  • palette to access palette by keyword (from presets), by number (from colourlovers). Use palette to resample palette or convert gradient to palette.
  • [[paletton-palette]] function to generate palette of type: :monochromatic, :triad, :tetrad with complementary color for given hue and configuration. See also Paletton website for details.

Call palette without any parameters to get list of predefined gradients.

Gradient

Gradient is continuous functions which accepts value from [0-1] range and returns color. Call gradient to create one.

Call gradient without any parameters to obtain list of predefined gradients.

Use gradient to convert any palette to gradient or access predefined gradients by keyword.

Conversions

To convert palette to gradient call gradient function. You can set interpolation method and colorspace. To convert gradient to palette call palette function.

Call palette to resample palette to other number of colors. Internally input palette is converted to gradient and sampled back.

Use lerp, lerp+, mix, average, mixbox to mix two colors in different ways.

Distances

Several functions to calculate difference between colors, delta-E*-xxx etc.

References

Color functions.

This namespace contains color manipulation functions which can be divided into following groups:

* Color creators
* Channel manipulations
* Conversions
* Palettes / gradients
* Distances

## Representation

Color can be represented by following types:

* fastmath `Vec4` - this is core type representing 3 color channels and alpha (RGBA). Values are `double` type from `[0-255]` range. [[color]], [[gray]] creators returns `Vec4` representation.
* fastmath `Vec3` - 3 channels (RGB), assuming `alpha` set to value of `255`.
* fastmath `Vec2` - gray with alpha
* `java.awt.Color` - Java AWT representation. Creators are [[awt-color]], [[awt-gray]]. Use [[to-awt-color]] to convert to this representation.
* `keyword` - one of the defined names (see [[named-colors-list]])
* `Integer` - packed ARGB value. If value is less than `0xff000000`, alpha is set to `0xff`. Example: `0xffaa01`.
* `String` - CSS (`#rgb` or `#rgba`) or string containg hexadecimal representation ("ffaa01")
* any `seqable` - list, vector containing 2-4 elements. Conversion is done by applying content to [[color]] function.

To create color from individual channel values use [[color]] function. To create gray for given intensity call [[gray]].

By default color is treated as `RGB` with values from ranges `[0.0-255.0]` inclusive.

All funtions internally convert any color representation to `Vec4` type using [[to-color]] function..

[Coloured list of all names](../static/colors.html)

## Color/ channel manipulations

You can access individual channels by calling on of the following:

* [[red]] or [[ch0]] - to get first channel value.
* [[green]] or [[ch1]] - to get second channel value.
* [[blue]] or [[ch2]] - to get third channel value.
* [[alpha]] - to get alpha value.
* [[luma]] - to get luma or brightness (range from `0` (black) to `255` (white)).
* [[hue]] - to get hue value in degrees (range from 0 to 360). Hexagon projection.
* [[hue-polar]] - to get hue from polar transformation.

[[set-ch0]], [[set-ch1]], [[set-ch2]] and [[set-alpha]] return new color with respective channel set to new value.

General [[set-channel]] and [[get-channel]] can work with any colorspace.

To make color darker/brighter use [[darken]] / [[lighten]] functions. Operations are done in `Lab` color space.

To change saturation call [[saturate]] / [[desaturate]]. Operations are done in `LCH` color space.

You can also [[modulate]] color (ie. multiply by given value).

## Conversions

Color can be converted from RGB to other color space (and back). List of color spaces are listed under [[colorspaces-list]] variable. There are two types of conversions:

* raw - with names `to-XXX` and `from-XXX` where `XXX` is color space name. Every color space has it's own value range for each channel. `(comp from-XXX to-XXX)` acts almost as identity.
* normalized - with names `to-XXX*` and `from-XXX*` where `XXX` is color space name. `to-XXX*` returns values normalized to `[0-255]` range. `from-XXX*` expects also channel values in range `[0-255]`.

NOTE: there is no information which color space is used. It's just a matter of your interpretation.

NOTE 2: be aware that converting function do not clamp any values to/from expected range.

Color space conversion functions are collected in two maps [[colorspaces]] for raw and [[colorspaces*]] for normalized functions. Keys are color space names as `keyword` and values are vectors with `to-` fn as first and `from-` fn as second element.
  
## Palettes / gradients

### Links

List of all defined colors and palettes:

* [Named palettes](../static/palettes/index.html)
* [Gradients](../static/gradients/index.html)

### Palette

Palette is just sequence of colors.

There are plenty of them predefined or can be generated:

* [[palette]] to access palette by keyword (from presets), by number (from colourlovers). Use [[palette]] to resample palette or convert gradient to palette.
* [[paletton-palette]] function to generate palette of type: `:monochromatic`, `:triad`, `:tetrad` with complementary color for given hue and configuration. See also [Paletton](http://paletton.com) website for details.

Call [[palette]] without any parameters to get list of predefined gradients.

### Gradient

Gradient is continuous functions which accepts value from `[0-1]` range and returns color. Call [[gradient]] to create one.

Call [[gradient]] without any parameters to obtain list of predefined gradients.

Use [[gradient]] to convert any palette to gradient or access predefined gradients by keyword.

### Conversions

To convert palette to gradient call [[gradient]] function. You can set interpolation method and colorspace.
To convert gradient to palette call [[palette]] function.

Call [[palette]] to resample palette to other number of colors. Internally input palette is converted to gradient and sampled back.

Use [[lerp]], [[lerp+]], [[mix]], [[average]], [[mixbox]] to mix two colors in different ways.

## Distances

Several functions to calculate difference between colors, `delta-E*-xxx` etc.

## References

* https://vis4.net/chromajs/
* https://github.com/thi-ng/color
* https://github.com/nschloe/colorio
raw docstring

achromatomalyclj

source

achromatopsiaclj

source

adjustclj

(adjust col channel value)
(adjust col colorspace channel value)

Adjust (add) given value to a chosen channel. Works with any color space.

Adjust (add) given value to a chosen channel. Works with any color space.
sourceraw docstring

adjust-temperatureclj

(adjust-temperature c temp)
(adjust-temperature c temp amount)

Adjust temperature of color.

Default amount: 0.35

See temperature and lerp+.

Adjust temperature of color.

Default amount: 0.35

See [[temperature]] and [[lerp+]].
sourceraw docstring

alphaclj

(alpha c)

Returns alpha value.

Returns alpha value.
sourceraw docstring

apply-themeclj

(apply-theme color color-theme)

Apply theme to the color, see color-themes for names.

Generates random color similar to provided one. All operations are done in LSH* color space (normalized to have values between 0 and 255).

Color theme can be one of:

  • keyword - predefined color theme is used
  • [L C H] - randomization scheme of given channel, which can be:
    • [min-value max-value] - uniform random value from given range
    • a number - [channel-value, channel+value] range is used for random selection
    • nil, or anything else - keep original channel value
Apply theme to the color, see [[color-themes]] for names.

Generates random color similar to provided one.
All operations are done in LSH* color space (normalized to have values between 0 and 255).

Color theme can be one of:

* keyword - predefined color theme is used
* [L C H] - randomization scheme of given channel, which can be:
    - [min-value max-value] - uniform random value from given range
    - a number - [channel-value, channel+value] range is used for random selection
    - nil, or anything else - keep original channel value
sourceraw docstring

averageclj

(average cs)
(average cs colorspace)

Average colors in given colorspace (default: :sRGB)

Average colors in given `colorspace` (default: `:sRGB`)
sourceraw docstring

awt-colorclj

(awt-color c)
(awt-color c a)
(awt-color r g b)
(awt-color r g b a)

Create java.awt.Color object.

See also color, gray.

Create java.awt.Color object.

See also [[color]], [[gray]].
sourceraw docstring

awt-grayclj

(awt-gray v)
(awt-gray v a)

Create grayscale color based on intensity v. Optional parameter alpha a.

AWT version of gray. See also awt-color

Create grayscale color based on intensity `v`. Optional parameter alpha `a`.

AWT version of [[gray]]. See also [[awt-color]]
sourceraw docstring

black?clj

(black? c)

Check if color is black

Check if color is black
sourceraw docstring

blackenclj

(blacken col)
(blacken col amt)

Change color towards black.

Works in HSB color space. Default amount is set to 0.2 and changes B channel by this amount.

Change color towards black.

Works in HSB color space. Default amount is set to 0.2 and changes B channel by this amount.
sourceraw docstring

blueclj

(blue c)

Returns blue (third channel) value.

Returns blue (third channel) value.
sourceraw docstring

brightenclj

(brighten col)
(brighten col amt)

Change luma for givent color by given amount.

Works in LAB color space. Default amount is 1.0 and means change luma in LAB of 18.0.

See darken.

Change luma for givent color by given amount.

Works in LAB color space. Default amount is 1.0 and means change luma in LAB of 18.0.

See [[darken]].
sourceraw docstring

brightnessclj

(brightness amount)
source

ch0clj

(ch0 c)

Returns first channel value. Same as red.

Returns first channel value. Same as [[red]].
sourceraw docstring

ch1clj

(ch1 c)

Returns second channel value. Same as green.

Returns second channel value. Same as [[green]].
sourceraw docstring

ch2clj

(ch2 c)

Returns third channel value. Same as blue.

Returns third channel value. Same as [[blue]].
sourceraw docstring

clampclj

(clamp c)

Clamp all color channels to [0-255] range.

Clamp all color channels to `[0-255]` range.
sourceraw docstring

colorclj

(color c)
(color c a)
(color r g b)
(color r g b a)

Create Vec4 object as color representation.

Arity:

  • 1 - convert to Vec4 from any color. Same as to-color
  • 2 - sets color alpha
  • 3 - sets r,g,b with alpha 255
  • 4 - sets r,g,b and alpha

See also gray. awt-color, awt-gray.

Create Vec4 object as color representation.

Arity: 

* 1 - convert to `Vec4` from any color. Same as [[to-color]]
* 2 - sets color alpha
* 3 - sets r,g,b with alpha 255
* 4 - sets r,g,b and alpha

See also [[gray]]. [[awt-color]], [[awt-gray]].
sourceraw docstring

color-converterclj

(color-converter cs)
(color-converter cs ch-scale)
(color-converter cs ch1-scale ch2-scale ch3-scale)
(color-converter cs ch1-scale ch2-scale ch3-scale ch4-scale)

Create function which converts provided color from cs color space using ch-scale as maximum value. (to simulate Processing colorMode fn).

Arity:

  • 1 - returns from-XXX* function
  • 2 - sets the same maximum value for each channel
  • 3 - sets individual maximum value without alpha, which is set to 0-255 range
  • 4 - all channels have it's own individual maximum value.
Create function which converts provided color from `cs` color space using `ch-scale` as maximum value. (to simulate Processing `colorMode` fn).

Arity:

* 1 - returns from-XXX* function
* 2 - sets the same maximum value for each channel
* 3 - sets individual maximum value without alpha, which is set to 0-255 range
* 4 - all channels have it's own individual maximum value.
sourceraw docstring

color-themesclj

source

colorspacesclj

Map of all color spaces functions.

  • key - name as keyword
  • value - vector with functions containing to-XXX and from-XXX converters.
Map of all color spaces functions.

* key - name as keyword
* value - vector with functions containing to-XXX and from-XXX converters.
sourceraw docstring

colorspaces*clj

Map of all color spaces functions (normalized).

  • key - name as keyword
  • value - vector with functions containing to-XXX* and from-XXX* converters.
Map of all color spaces functions (normalized).

* key - name as keyword
* value - vector with functions containing to-XXX* and from-XXX* converters.
sourceraw docstring

colorspaces-listclj

List of all color space names.

List of all color space names.
sourceraw docstring

complementaryclj

(complementary c)
(complementary c colorspace)

Create complementary color. Possible colorspaces are:

  • :PalettonHSV (default)
  • :HSB, :HSV, :HSL or :HWB
  • :GLHS
Create complementary color. Possible colorspaces are:

* `:PalettonHSV` (default)
* `:HSB`, `:HSV`, `:HSL` or `:HWB`
* `:GLHS`
sourceraw docstring

contrastclj

(contrast amount)
source

contrast-ratioclj

(contrast-ratio c1 c2)

WCAG contrast ratio.

Based on YUV luma.

WCAG contrast ratio.

Based on YUV luma.
sourceraw docstring

correct-lumaclj

(correct-luma palette-or-gradient)
(correct-luma palette-or-gradient gradient-params)

Create palette or gradient with corrected luma to be linear.

See here

Create palette or gradient with corrected luma to be linear.

See [here](https://www.vis4.net/blog/2013/09/mastering-multi-hued-color-scales/#combining-bezier-interpolation-and-lightness-correction)
sourceraw docstring

darkenclj

(darken col)
(darken col amt)

Change luma for givent color by given amount.

Works in LAB color space. Default amount is 1.0 and means change luma in LAB of -18.0.

See brighten.

Change luma for givent color by given amount.

Works in LAB color space. Default amount is 1.0 and means change luma in LAB of -18.0.

See [[brighten]].
sourceraw docstring

delta-ccljdeprecated

source

delta-C*clj

(delta-C* c1 c2)

ΔC*_ab difference, chroma difference in LAB color space, CIE 1976

ΔC*_ab difference, chroma difference in LAB color space, CIE 1976
sourceraw docstring

delta-C-RGBclj

(delta-C-RGB c1 c2)

ΔC in RGB color space

ΔC in RGB color space
sourceraw docstring

delta-D-HCLclj

(delta-D-HCL c1 c2)

Color difference in HCL (Sarifuddin and Missaou) color space

Color difference in HCL (Sarifuddin and Missaou) color space
sourceraw docstring

delta-E*clj

(delta-E* c1 c2)

ΔE*_ab difference, CIE 1976

ΔE*_ab difference, CIE 1976
sourceraw docstring

delta-E*-2000clj

(delta-E*-2000 c1 c2)
(delta-E*-2000 c1 c2 l c h)
ΔE* color difference, CIE 2000

http://www2.ece.rochester.edu/~gsharma/ciede2000/ciede2000noteCRNA.pdf
sourceraw docstring

delta-E*-94clj

(delta-E*-94 c1 c2)

ΔE* difference, CIE 1994

ΔE* difference, CIE 1994
sourceraw docstring

delta-E*-CMCclj

(delta-E*-CMC c1 c2)
(delta-E*-CMC c1 c2 l c)

ΔE* CMC difference

Parameters l and c defaults to 1.0. Other common settings is l=2.0 and c=1.0.

ΔE* CMC difference

Parameters `l` and `c` defaults to 1.0. Other common settings is `l=2.0` and `c=1.0`.
sourceraw docstring

delta-E*-euclideanclj

(delta-E*-euclidean c1 c2)
(delta-E*-euclidean c1 c2 colorspace)
source

delta-e-ciecljdeprecated

Delta E CIE distance (euclidean in LAB colorspace.

Delta E CIE distance (euclidean in LAB colorspace.
sourceraw docstring

delta-e-cmccljdeprecated

source

delta-E-HyABclj

(delta-E-HyAB c1 c2)

ΔE_HyAB difference

ΔE_HyAB difference
sourceraw docstring

delta-e-jabcljdeprecated

source

delta-E-zclj

(delta-E-z c1 c2)

ΔE* calculated in JAB color space.

ΔE* calculated in JAB color space.
sourceraw docstring

delta-hcljdeprecated

source

delta-H*clj

(delta-H* c1 c2)

ΔH* difference, hue difference in LAB, CIE 1976

ΔH* difference, hue difference in LAB, CIE 1976
sourceraw docstring

desaturateclj

(desaturate col)
(desaturate col amt)

Change color saturation in LCH color space.

Change color saturation in LCH color space.
sourceraw docstring

deuteranomalyclj

source

deuteranopiaclj

source

exposureclj

(exposure amount)
source

fe-color-matrixclj

(fe-color-matrix [r1 r2 r3 r4 r5 g1 g2 g3 g4 g5 b1 b2 b3 b4 b5 a1 a2 a3 a4 a5])

Create a feColorMatrix operator.

Create a feColorMatrix operator.
sourceraw docstring

find-gradientclj

source

find-paletteclj

source

format-hexclj

(format-hex c)

Convert color to hex string (css).

When alpha is lower than 255.0, #rgba is returned.

Convert color to hex string (css).

When alpha is lower than 255.0, #rgba is returned.
sourceraw docstring

from-CMYclj

CMY -> RGB

CMY -> RGB
sourceraw docstring

from-CMY*clj

CMY -> RGB, alias for from-CMY

CMY -> RGB, alias for [[from-CMY]]
sourceraw docstring

from-Cubehelixclj

(from-Cubehelix c)

Cubehelix -> RGB

For ranges, see to-Cubehelix.

Cubehelix -> RGB

For ranges, see [[to-Cubehelix]].
sourceraw docstring

from-Cubehelix*clj

(from-Cubehelix* c)

Cubehelix -> RGB, normalized

Cubehelix -> RGB, normalized
sourceraw docstring

from-DIN99clj

DIN99 -> RGB

DIN99 -> RGB
sourceraw docstring

from-DIN99*clj

DIN99 -> RGB, normalized

DIN99 -> RGB, normalized
sourceraw docstring

from-DIN99bclj

DIN99b -> RGB

DIN99b -> RGB
sourceraw docstring

from-DIN99b*clj

DIN99b -> RGB, normalized

DIN99b -> RGB, normalized
sourceraw docstring

from-DIN99cclj

DIN99c -> RGB

DIN99c -> RGB
sourceraw docstring

from-DIN99c*clj

DIN99c -> RGB, normalized

DIN99c -> RGB, normalized
sourceraw docstring

from-DIN99dclj

DIN99d -> RGB

DIN99d -> RGB
sourceraw docstring

from-DIN99d*clj

DIN99d -> RGB, normalized

DIN99d -> RGB, normalized
sourceraw docstring

from-DIN99oclj

DIN99o -> RGB

DIN99o -> RGB
sourceraw docstring

from-DIN99o*clj

DIN99o -> RGB, normalized

DIN99o -> RGB, normalized
sourceraw docstring

from-GLHSclj

(from-GLHS c)

GLHS -> RGB

For ranges, see to-GLHS.

GLHS -> RGB

For ranges, see [[to-GLHS]].
sourceraw docstring

from-GLHS*clj

(from-GLHS* c)

GLHS -> RGB

GLHS -> RGB
sourceraw docstring

from-Grayclj

RGB -> Grayscale

RGB -> Grayscale
sourceraw docstring

from-Gray*clj

RGB -> Grayscale

RGB -> Grayscale
sourceraw docstring

from-HCLclj

(from-HCL c)

HCL -> RGB, by Sarifuddin and Missaou.

For accepted ranges, see to-HCL.

HCL -> RGB, by Sarifuddin and Missaou.

For accepted ranges, see [[to-HCL]].
sourceraw docstring

from-HCL*clj

(from-HCL* c)

HCL -> RGB, normalized

HCL -> RGB, normalized
sourceraw docstring

from-HSBclj

HSB(V) -> RGB, normalized (see from-HSV)

HSB(V) -> RGB, normalized (see [[from-HSV]])
sourceraw docstring

from-HSB*clj

HSB(V) -> RGB (see from-HSV*)

HSB(V) -> RGB (see [[from-HSV*]])
sourceraw docstring

from-HSIclj

(from-HSI c)

HSI -> RGB

For ranges, see to-HSI.

HSI -> RGB

For ranges, see [[to-HSI]].
sourceraw docstring

from-HSI*clj

HSI -> RGB, normalized

HSI -> RGB, normalized
sourceraw docstring

from-HSLclj

(from-HSL c)

HSL -> RGB

For ranges, see to-HSL.

HSL -> RGB

For ranges, see [[to-HSL]].
sourceraw docstring

from-HSL*clj

HSL -> RGB, normalized

HSL -> RGB, normalized
sourceraw docstring

from-HSVclj

(from-HSV c)

HSV -> RGB

Same as HSB.

For ranges, see to-HSV.

HSV -> RGB

Same as HSB.

For ranges, see [[to-HSV]].
sourceraw docstring

from-HSV*clj

HSV -> RGB, normalized

HSV -> RGB, normalized
sourceraw docstring

from-HunterLABclj

(from-HunterLAB c)

HunterLAB -> RGB

For ranges, see to-HunterLAB

HunterLAB -> RGB

For ranges, see [[to-HunterLAB]]
sourceraw docstring

from-HunterLAB*clj

(from-HunterLAB* c)

HunterLAB -> RGB, normalized

HunterLAB -> RGB, normalized
sourceraw docstring

from-HWBclj

(from-HWB c)

HWB -> RGB

For ranges, see to-HWB.

HWB -> RGB

For ranges, see [[to-HWB]].
sourceraw docstring

from-HWB*clj

HWB -> RGB, normalized

HWB -> RGB, normalized
sourceraw docstring

from-IgPgTgclj

(from-IgPgTg c)

IgPgTg -> RGB

IgPgTg -> RGB
sourceraw docstring

from-IgPgTg*clj

(from-IgPgTg* c)

IgPgTg -> RGB, normalized

IgPgTg -> RGB, normalized
sourceraw docstring

from-IPTclj

(from-IPT c)

IPT -> RGB

IPT -> RGB
sourceraw docstring

from-IPT*clj

(from-IPT* c)

IPT -> RGB, normalized

IPT -> RGB, normalized
sourceraw docstring

from-JABclj

(from-JAB c)

JzAzBz -> RGB

For ranges, see to-JAB.

JzAzBz -> RGB

For ranges, see [[to-JAB]].
sourceraw docstring

from-JAB*clj

(from-JAB* c)

JzAzBz -> RGB, normalized

JzAzBz -> RGB, normalized
sourceraw docstring

from-JCHclj

(from-JCH c)

JCH -> RGB

For ranges, see to-JCH.

JCH -> RGB

For ranges, see [[to-JCH]].
sourceraw docstring

from-JCH*clj

(from-JCH* c)

JCH -> RGB, normalized

JCH -> RGB, normalized
sourceraw docstring

from-LABclj

(from-LAB c)

LAB -> RGB,

For ranges, see to-LAB

LAB -> RGB,

For ranges, see [[to-LAB]]
sourceraw docstring

from-LAB*clj

(from-LAB* c)

LAB -> RGB, normalized

LAB -> RGB, normalized
sourceraw docstring

from-LCHclj

(from-LCH c)

LCH -> RGB

For ranges, see to-LCH.

LCH -> RGB

For ranges, see [[to-LCH]].
sourceraw docstring

from-LCH*clj

(from-LCH* c)

LCH -> RGB, normalized

LCH -> RGB, normalized
sourceraw docstring

from-LCHuvclj

(from-LCHuv c)

LCHuv -> RGB

For ranges, see to-LCH.

LCHuv -> RGB

For ranges, see [[to-LCH]].
sourceraw docstring

from-LCHuv*clj

(from-LCHuv* c)

LCHuv -> RGB, normalized

LCHuv -> RGB, normalized
sourceraw docstring

from-linearclj

(from-linear v)

Gamma correction (gamma=1/2.4), lighten

Gamma correction (gamma=1/2.4), lighten
sourceraw docstring

from-linearRGBclj

linearRGB -> sRGB

linearRGB -> sRGB
sourceraw docstring

from-linearRGB*clj

linearRGB -> sRGB

linearRGB -> sRGB
sourceraw docstring

from-LMSclj

(from-LMS c)

LMS -> RGB, D65

Ranges: 0.0 - 100.0

LMS -> RGB, D65

Ranges: 0.0 - 100.0
sourceraw docstring

from-LMS*clj

(from-LMS* c)

LMS -> RGB, normalized

LMS -> RGB, normalized
sourceraw docstring

from-luma-color-hueclj

(from-luma-color-hue from c)

For given color space convert from polar representation of the color

For given color space convert from polar representation of the color
sourceraw docstring

from-LUVclj

(from-LUV c)

LUV -> RGB

For ranges, see to-LUV

LUV -> RGB

For ranges, see [[to-LUV]]
sourceraw docstring

from-LUV*clj

(from-LUV* c)

LUV -> RGB, normalized

LUV -> RGB, normalized
sourceraw docstring

from-OHTAclj

(from-OHTA c)

OHTA -> RGB

For ranges, see to-OHTA.

OHTA -> RGB

For ranges, see [[to-OHTA]].
sourceraw docstring

from-OHTA*clj

(from-OHTA* c)

OHTA -> RGB, normalized

OHTA -> RGB, normalized
sourceraw docstring

from-Okhslclj

(from-Okhsl c)

Okhsl -> sRGB

Okhsl -> sRGB
sourceraw docstring

from-Okhsl*clj

(from-Okhsl* c)

Okhsl -> sRGB, normalized

Okhsl -> sRGB, normalized
sourceraw docstring

from-Okhsvclj

(from-Okhsv c)

Okhsv -> sRGB

Okhsv -> sRGB
sourceraw docstring

from-Okhsv*clj

(from-Okhsv* c)

Okhsv -> sRGB, normalized

Okhsv -> sRGB, normalized
sourceraw docstring

from-Okhwbclj

(from-Okhwb c)

Okhwb -> sRGB

Okhwb -> sRGB
sourceraw docstring

from-Okhwb*clj

(from-Okhwb* c)

Okhwb -> sRGB, normalized

Okhwb -> sRGB, normalized
sourceraw docstring

from-Oklabclj

(from-Oklab c)

Oklab -> RGB, see to-Oklab

Oklab -> RGB, see [[to-Oklab]]
sourceraw docstring

from-Oklab*clj

(from-Oklab* c)

RGB -> Oklab, normalized

RGB -> Oklab, normalized
sourceraw docstring

from-Oklchclj

(from-Oklch c)

Oklch -> RGB

Oklch -> RGB
sourceraw docstring

from-Oklch*clj

(from-Oklch* c)

Oklch -> RGB, normalized

Oklch -> RGB, normalized
sourceraw docstring

from-OSAclj

(from-OSA c)

RGB -> OSA-UCS

For ranges, see to-OSA.

RGB -> OSA-UCS

For ranges, see [[to-OSA]].
sourceraw docstring

from-OSA*clj

(from-OSA* c)

OSA-UCS -> RGB, normalized

Note that due to some extreme outliers, normalization is triple cubic power for g and j.

OSA-UCS -> RGB, normalized

Note that due to some extreme outliers, normalization is triple cubic power for `g` and `j`.
sourceraw docstring

from-PalettonHSVclj

(from-PalettonHSV c)
source

from-PalettonHSV*clj

(from-PalettonHSV* c)
source

from-RGBclj

Alias for to-color

Alias for [[to-color]]
sourceraw docstring

from-RGB*clj

Alias for to-color

Alias for [[to-color]]
sourceraw docstring

from-RYBclj

(from-RYB c)

RYB -> RGB

RYB -> RGB
sourceraw docstring

from-RYB*clj

RYB -> RGB, normalized

RYB -> RGB, normalized
sourceraw docstring

from-sRGBclj

(from-sRGB c)

sRGB -> RGB

sRGB -> RGB
sourceraw docstring

from-sRGB*clj

sRGB -> linear RGB

sRGB -> linear RGB
sourceraw docstring

from-UCSclj

(from-UCS c)

UCS -> sRGB

UCS -> sRGB
sourceraw docstring

from-UCS*clj

(from-UCS* c)

UCS -> sRGB, normalized

UCS -> sRGB, normalized
sourceraw docstring

from-UVWclj

(from-UVW c)

UVW -> sRGB

UVW -> sRGB
sourceraw docstring

from-UVW*clj

(from-UVW* c)

UVW -> sRGB, normalized

UVW -> sRGB, normalized
sourceraw docstring

from-XYBclj

(from-XYB c)

XYB -> sRGB

XYB -> sRGB
sourceraw docstring

from-XYB*clj

(from-XYB* c)

XYB -> sRGB, normalized

XYB -> sRGB, normalized
sourceraw docstring

from-XYZclj

(from-XYZ c)

XYZ -> sRGB

For ranges, see to-XYZ

XYZ -> sRGB

For ranges, see [[to-XYZ]]
sourceraw docstring

from-XYZ*clj

(from-XYZ* c)

XYZ -> sRGB, normalized

XYZ -> sRGB, normalized
sourceraw docstring

from-XYZ1clj

(from-XYZ1 c)

XYZ -> sRGB, from range 0-1

XYZ -> sRGB, from range 0-1
sourceraw docstring

from-XYZ1*clj

XYZ -> sRGB, normalized

XYZ -> sRGB, normalized
sourceraw docstring

from-YCbCrclj

(from-YCbCr c)

YCbCr -> RGB

For ranges, see to-YCbCr.

YCbCr -> RGB

For ranges, see [[to-YCbCr]].
sourceraw docstring

from-YCbCr*clj

(from-YCbCr* c)

YCbCr -> RGB, normalized

YCbCr -> RGB, normalized
sourceraw docstring

from-YCgCoclj

(from-YCgCo c)

YCgCo -> RGB

For ranges, see to-YCgCo.

YCgCo -> RGB

For ranges, see [[to-YCgCo]].
sourceraw docstring

from-YCgCo*clj

(from-YCgCo* c)

YCgCo -> RGB, normalized

YCgCo -> RGB, normalized
sourceraw docstring

from-YDbDrclj

(from-YDbDr c)

YDbDr -> RGB

For ranges, see to-YDbDr.

YDbDr -> RGB

For ranges, see [[to-YDbDr]].
sourceraw docstring

from-YDbDr*clj

(from-YDbDr* c)

YDbDr -> RGB, normalized

YDbDr -> RGB, normalized
sourceraw docstring

from-YIQclj

(from-YIQ c)

YIQ -> RGB

For ranges, see to-YIQ.

YIQ -> RGB

For ranges, see [[to-YIQ]].
sourceraw docstring

from-YIQ*clj

(from-YIQ* c)

YIQ -> RGB, normalized

YIQ -> RGB, normalized
sourceraw docstring

from-YPbPrclj

(from-YPbPr c)

YPbPr -> RGB

For ranges, see to-YPbPr.

YPbPr -> RGB

For ranges, see [[to-YPbPr]].
sourceraw docstring

from-YPbPr*clj

(from-YPbPr* c)

YPbPr -> RGB, normalized

YPbPr -> RGB, normalized
sourceraw docstring

from-YUVclj

(from-YUV c)

YUV -> RGB

For ranges, see to-YUV.

YUV -> RGB

For ranges, see [[to-YUV]].
sourceraw docstring

from-YUV*clj

(from-YUV* c)

YUV -> RGB, normalized

YUV -> RGB, normalized
sourceraw docstring

from-Yxyclj

(from-Yxy c)

Yxy -> sRGB

For ranges, see to-Yxy.

Yxy -> sRGB

For ranges, see [[to-Yxy]].
sourceraw docstring

from-Yxy*clj

(from-Yxy* c)

Yxy -> sRGB, normalized

Yxy -> sRGB, normalized
sourceraw docstring

get-channelclj

(get-channel col channel)
(get-channel col colorspace channel)

Get chosen channel. Works with any color space.

Get chosen channel. Works with any color space.
sourceraw docstring

gradientclj

(gradient)
(gradient palette-or-gradient-name)
(gradient palette-or-gradient-name options)

Return gradient function.

Grandient function accepts value from 0 to 1 and returns interpolated color.

Parameters;

  • palette-or-gradient-name - name of the predefined gradient or palette (seq of colors).
  • (optional) additional parameters map:
    • :colorspace - operate in given color space. Default: :RGB.
    • :interpolation - interpolation name or interpolation function. Interpolation can be one of [[interpolators-1d-list]] or [[easings-list]]. When easings is used, only first two colors are interpolated. Default: :linear-smile.
    • :to? - turn on/off conversion to given color space. Default: true.
    • :from? - turn on/off conversion from given color space. Default: true.
    • :domain - interpolation domain as seq of values for each color.

When called without parameters random gradient is returned.

Return gradient function.

Grandient function accepts value from 0 to 1 and returns interpolated color.

Parameters;

* `palette-or-gradient-name` - name of the [predefined gradient](../static/gradients.html) or palette (seq of colors).
* (optional) additional parameters map:
    * `:colorspace` - operate in given color space. Default: `:RGB`.
    * `:interpolation` - interpolation name or interpolation function. Interpolation can be one of [[interpolators-1d-list]] or [[easings-list]]. When easings is used, only first two colors are interpolated. Default: `:linear-smile`.
    * `:to?` - turn on/off conversion to given color space. Default: `true`.
    * `:from?` - turn on/off conversion from given color space. Default: `true`.
    * `:domain` - interpolation domain as seq of values for each color.

When called without parameters random gradient is returned.
sourceraw docstring

gradient-cubehelixclj

Cubehelix gradient generator from two colors.

Cubehelix gradient generator from two colors.
sourceraw docstring

grayclj

(gray v)
(gray v a)

Create grayscale color based on intensity v. Optional parameter alpha a.

See also color

Create grayscale color based on intensity `v`. Optional parameter alpha `a`.

See also [[color]]
sourceraw docstring

grayscaleclj

(grayscale amount)
source

greenclj

(green c)

Returns green (second channel) value.

Returns green (second channel) value.
sourceraw docstring

hueclj

(hue c)

Hue value of color (any representation). Returns angle (0-360).

Uses hexagonal transformation. See also hue-polar.

Hue value of color (any representation). Returns angle (0-360).

Uses hexagonal transformation. See also [[hue-polar]].
sourceraw docstring

hue-palettonclj

(hue-paletton c)
(hue-paletton r g b)

Convert color to paletton HUE (which is different than hexagon or polar conversion).

Convert color to paletton HUE (which is different than hexagon or polar conversion).
sourceraw docstring

hue-polarclj

(hue-polar c)

Hue value of color (any representation). Returns angle (0-360).

Uses polar transformation. See also hue.

Hue value of color (any representation). Returns angle (0-360).

Uses polar transformation. See also [[hue]].
sourceraw docstring

hue-rotateclj

(hue-rotate angle-degrees)
source

iq-gradientclj

(iq-gradient c1 c2)
(iq-gradient a b c d)

Create gradient generator function with given parametrization or two colors.

See http://iquilezles.org/www/articles/palettes/palettes.htm and https://github.com/thi-ng/color/blob/master/src/gradients.org#gradient-coefficient-calculation

Parameters should be Vec3 type.

Create gradient generator function with given parametrization or two colors.

See http://iquilezles.org/www/articles/palettes/palettes.htm and https://github.com/thi-ng/color/blob/master/src/gradients.org#gradient-coefficient-calculation

Parameters should be `Vec3` type.
sourceraw docstring

lclampclj

(lclamp c)

Clamp all color channels to [0-255] range. Round if necessary.

Clamp all color channels to `[0-255]` range. Round if necessary.
sourceraw docstring

lerpclj

(lerp c1 c2)
(lerp c1 c2 t)
(lerp c1 c2 colorspace t)

Linear interpolation of two colors.

See also lerp+, lerp-, gradient and mix

Linear interpolation of two colors.

See also [[lerp+]], [[lerp-]], [[gradient]] and [[mix]]
sourceraw docstring

lerp+clj

(lerp+ c1 c2)
(lerp+ c1 c2 amount)
(lerp+ c1 c2 colorspace amount)

Linear interpolation of two colors conserving luma of the second color.

Amount: strength of the blend (defaults to 0.5).

See also lerp-.

Linear interpolation of two colors conserving luma of the second color.

Amount: strength of the blend (defaults to 0.5).

See also [[lerp-]].
sourceraw docstring

lerp-clj

(lerp- c1 c2)
(lerp- c1 c2 amount)
(lerp- c1 c2 colorspace amount)

Linear interpolation of two colors conserving luma of the first color.

Amount: strength of the blend (defaults to 0.5)

See also lerp+.

Linear interpolation of two colors conserving luma of the first color.

Amount: strength of the blend (defaults to 0.5)

See also [[lerp+]].
sourceraw docstring

lumaclj

(luma c)

Returns luma

Returns luma
sourceraw docstring

make-LCHclj

(make-LCH cs)

Create LCH conversion functions pair from any luma based color space.

Create LCH conversion functions pair from any luma based color space. 
sourceraw docstring

merge-gradientsclj

(merge-gradients g1 g2)
(merge-gradients g1 g2 midpoint)

Combine two gradients, optionally select midpoint (0.5 by default).

Resulting gradient has colors from g1 for values lower than midpoint and from g2 for values higher than midpoint

Combine two gradients, optionally select `midpoint` (0.5 by default).

Resulting gradient has colors from `g1` for values lower than `midpoint` and from `g2` for values higher than `midpoint`
sourceraw docstring

mixclj

(mix c1 c2)
(mix c1 c2 t)
(mix c1 c2 colorspace t)

Mix colors in given optional colorspace (default: :RGB) and optional ratio (default: 0.5).

chroma.js way

Mix colors in given optional `colorspace` (default: `:RGB`) and optional ratio (default: 0.5).

chroma.js way
sourceraw docstring

mixboxclj

(mixbox col1 col2)
(mixbox col1 col2 t)

Pigment based color mixing.

https://github.com/scrtwpns/mixbox

Pigment based color mixing.

https://github.com/scrtwpns/mixbox
sourceraw docstring

mixsubclj

(mixsub c1 c2)
(mixsub c1 c2 t)
(mixsub c1 c2 colorspace t)

Subtractive color mix in given optional colorspace (default: :RGB) and optional ratio (default: 0.5)

Subtractive color mix in given optional `colorspace` (default: `:RGB`) and optional ratio (default: 0.5)
sourceraw docstring

modulateclj

(modulate col channel amount)
(modulate col colorspace channel amount)

Modulate (multiply) chosen channel by given amount. Works with any color space.

Modulate (multiply) chosen channel by given amount. Works with any color space.
sourceraw docstring

named-colors-listclj

(named-colors-list)

Return list of the named colors.

Return list of the named colors.
sourceraw docstring

nearest-colorclj

(nearest-color pal)
(nearest-color pal c)
(nearest-color pal c dist-fn)

Find nearest color from a set. Input: distance function (default euclidean), list of target colors and source color.

Find nearest color from a set. Input: distance function (default euclidean), list of target colors and source color.
sourceraw docstring

negateclj

(negate c)
(negate c alpha?)

Negate color (subract from 255.0)

Negate color (subract from 255.0)
sourceraw docstring

not-black?clj

(not-black? c)

Check if color is not black

Check if color is not black
sourceraw docstring

noticable-different?clj

(noticable-different? c1 c2)
(noticable-different? c1 c2 s p)

Returns noticable difference (true/false) between colors.

Defined in: https://research.tableau.com/sites/default/files/2014CIC_48_Stone_v3.pdf

Implementation from: https://github.com/connorgr/d3-jnd/blob/master/src/jnd.js

Returns noticable difference (true/false) between colors.

Defined in: https://research.tableau.com/sites/default/files/2014CIC_48_Stone_v3.pdf

Implementation from: https://github.com/connorgr/d3-jnd/blob/master/src/jnd.js
sourceraw docstring

p25_7clj

source

packclj

(pack c)

Pack color to ARGB 32bit integer.

Pack color to ARGB 32bit integer.
sourceraw docstring

paletteclj

(palette)
(palette p)
(palette p number-of-colors)
(palette p number-of-colors gradient-params)

Get palette.

If argument is a keyword, returns one from palette presets. If argument is a number, returns one from colourlovers palettes. If argument is a gradient, returns 5 or number-of-colors samples.

If called without argument, random palette is returned

Optionally you can pass number of requested colors and other parameters as in resample

Get palette.

If argument is a keyword, returns one from palette presets.
If argument is a number, returns one from colourlovers palettes.
If argument is a gradient, returns 5 or `number-of-colors` samples.

If called without argument, random palette is returned

Optionally you can pass number of requested colors and other parameters as in [[resample]]
sourceraw docstring

palettoncljmultimethod

Create paletton palette.

Input:

  • type - one of: :monochromatic (one hue), :triad (three hues), :tetrad (four hues)
  • hue - paletton version of hue (use hue-paletton to get hue value).
  • configuration as a map

Configuration consist:

  • :preset - one of paletton-presets-list, default :full.
  • :compl - generate complementary color?, default false. Works with :monochromatic and :triad
  • :angle - hue angle for additional colors for :triad and :tetrad.
  • :adj - for :triad only, generate adjacent (default true) values or not.
Create [paletton](http://paletton.com/) palette.

Input:

* type - one of: `:monochromatic` (one hue), `:triad` (three hues), `:tetrad` (four hues)
* hue - paletton version of hue (use [[hue-paletton]] to get hue value).
* configuration as a map

Configuration consist:

* `:preset` - one of [[paletton-presets-list]], default `:full`.
* `:compl` - generate complementary color?, default `false`. Works with `:monochromatic` and `:triad`
* `:angle` - hue angle for additional colors for `:triad` and `:tetrad`.
* `:adj` - for `:triad` only, generate adjacent (default `true`) values or not.
sourceraw docstring

paletton-presets-listclj

Paletton presets names

Paletton presets names
sourceraw docstring

possible-color?clj

(possible-color? c)

Check if given argument can be considered as color.

Check is done by analyzing type of the argument.

See also valid-color?.

Check if given argument can be considered as color.

Check is done by analyzing type of the argument.

See also [[valid-color?]].
sourceraw docstring

possible-palette?clj

(possible-palette? c)

Check if given argument can be considered as palette.

Check is done by analyzing type of the argument.

Check if given argument can be considered as palette.

Check is done by analyzing type of the argument.
sourceraw docstring

protanomalyclj

source

protanopiaclj

source

quilclj

Convert color to quil color type (ie. ARGB Integer). Alias to pack.

Convert color to `quil` color type (ie. ARGB Integer). Alias to [[pack]].
sourceraw docstring

r30clj

source

r6clj

source

r63clj

source

random-colorclj

(random-color)
(random-color alpha-or-color-theme)
(random-color color-theme alpha)

Generate random color.

Optionally color theme or alpha can be provided.

List of possible color themes is stored in color-themes var. These are taken from thi.ng and paletton.

Generate random color.

Optionally color theme or alpha can be provided.

List of possible color themes is stored in `color-themes` var. These are taken from thi.ng and paletton.
sourceraw docstring

random-gradientclj

(random-gradient)

Generate random gradient function.

Generate random gradient function.
sourceraw docstring

random-paletteclj

(random-palette)

Generate random palette from all collections defined in clojure2d.color namespace.

Generate random palette from all collections defined in clojure2d.color namespace.
sourceraw docstring

redclj

(red c)

Returns red (first channel) value.

Returns red (first channel) value.
sourceraw docstring

reduce-colorsclj

(reduce-colors xs number-of-colors)
(reduce-colors xs number-of-colors colorspace-or-dist)

Reduce colors using x-means clustering in given colorspace (default :RGB).

Use for long sequences (for example to generate palette from image).

Reduce colors using x-means clustering in given `colorspace` (default `:RGB`).

Use for long sequences (for example to generate palette from image).
sourceraw docstring

relative-lumaclj

(relative-luma c)

Returns relative luminance

Returns relative luminance
sourceraw docstring

resampleclj

(resample pal number-of-colors)
(resample pal number-of-colors gradient-params)

Resample palette.

Internally it's done by creating gradient and sampling back to colors. You can pass gradient parameters like colorspace, interpolator name and domain.

Resample palette.

Internally it's done by creating gradient and sampling back to colors. You can pass [[gradient]] parameters like colorspace, interpolator name and domain.
sourceraw docstring

saturateclj

(saturate col)
(saturate col amt)

Change color saturation in LCH color space.

Change color saturation in LCH color space.
sourceraw docstring

saturationclj

(saturation amount)
source

scaleclj

(scale c v)
(scale c v alpha?)

Multiply color channels by given value, do not change alpha channel by default

Multiply color channels by given value, do not change alpha channel by default
sourceraw docstring

scale-downclj

(scale-down c)
(scale-down c alpha?)

Divide color channels by 255.0

Divide color channels by 255.0
sourceraw docstring

scale-upclj

(scale-up c)
(scale-up c alpha?)

Multiply color channels by 255.0

Multiply color channels by 255.0
sourceraw docstring

sepiaclj

(sepia amount)
source

set-alphaclj

(set-alpha c a)

Set alpha channel and return new color

Set alpha channel and return new color
sourceraw docstring

set-awt-alphaclj

(set-awt-alpha c a)

Set alpha channel and return Color representation.

Set alpha channel and return `Color` representation.
sourceraw docstring

set-blueclj

(set-blue c val)

Set blue channel and return new color

Set blue channel and return new color
sourceraw docstring

set-ch0clj

(set-ch0 c val)

Set red channel and return new color.

Set red channel and return new color.
sourceraw docstring

set-ch1clj

(set-ch1 c val)

Set green channel and return new color.

Set green channel and return new color.
sourceraw docstring

set-ch2clj

(set-ch2 c val)

Set blue channel and return new color

Set blue channel and return new color
sourceraw docstring

set-channelclj

(set-channel col channel val)
(set-channel col colorspace channel val)

Set chosen channel with given value. Works with any color space.

Set chosen channel with given value. Works with any color space.
sourceraw docstring

set-greenclj

(set-green c val)

Set green channel and return new color.

Set green channel and return new color.
sourceraw docstring

set-redclj

(set-red c val)

Set red channel and return new color.

Set red channel and return new color.
sourceraw docstring

temperatureclj

(temperature t)

Color representing given black body temperature t in Kelvins (or name as keyword).

Reference: CIE 1964 10 degree CMFs

Using improved interpolation functions.

Possible temperature names: :candle, :sunrise, :sunset, :lightbulb, :morning, :moonlight, :midday, :cloudy-sky, :blue-sky, :warm, :cool, :white, :sunlight

Color representing given black body temperature `t` in Kelvins (or name as keyword).

Reference: CIE 1964 10 degree CMFs

Using improved interpolation functions.

Possible temperature names: `:candle`, `:sunrise`, `:sunset`, `:lightbulb`, `:morning`, `:moonlight`, `:midday`, `:cloudy-sky`, `:blue-sky`, `:warm`, `:cool`, `:white`, `:sunlight`
sourceraw docstring

temperature-namesclj

source

thing-presets-listclj

source

tinterclj

(tinter tint-color)

Creates fn to tint color using other color(s).

tint-color

Creates fn to tint color using other color(s).

`tint-color`
sourceraw docstring

to-awt-colorclj

(to-awt-color c)

Convert any color representation to java.awt.Color.

Convert any color representation to `java.awt.Color`.
sourceraw docstring

to-CMYclj

(to-CMY c)

RGB -> CMY

RGB -> CMY
sourceraw docstring

to-CMY*clj

CMY -> RGB, alias for to-CMY

CMY -> RGB, alias for [[to-CMY]]
sourceraw docstring

to-colorclj

(to-color c)

Convert any color representation to Vec4 vector.

Convert any color representation to `Vec4` vector.
sourceraw docstring

to-Cubehelixclj

(to-Cubehelix c)

RGB -> Cubehelix

D3 version

Ranges:

  • H: 0.0 - 360.0
  • S: 0.0 - 4.61
  • L: 0.0 - 1.0
RGB -> Cubehelix

D3 version

Ranges:

* H: 0.0 - 360.0
* S: 0.0 - 4.61
* L: 0.0 - 1.0
sourceraw docstring

to-Cubehelix*clj

(to-Cubehelix* c)

RGB -> Cubehelix, normalized

RGB -> Cubehelix, normalized
sourceraw docstring

to-DIN99clj

RGB -> DIN99

RGB -> DIN99
sourceraw docstring

to-DIN99*clj

RGB -> DIN99, normalized

RGB -> DIN99, normalized
sourceraw docstring

to-DIN99bclj

RGB -> DIN99

RGB -> DIN99
sourceraw docstring

to-DIN99b*clj

RGB -> DIN99b, normalized

RGB -> DIN99b, normalized
sourceraw docstring

to-DIN99cclj

RGB -> DIN99

RGB -> DIN99
sourceraw docstring

to-DIN99c*clj

RGB -> DIN99c, normalized

RGB -> DIN99c, normalized
sourceraw docstring

to-DIN99dclj

RGB -> DIN99

RGB -> DIN99
sourceraw docstring

to-DIN99d*clj

RGB -> DIN99d, normalized

RGB -> DIN99d, normalized
sourceraw docstring

to-DIN99oclj

RGB -> DIN99

RGB -> DIN99
sourceraw docstring

to-DIN99o*clj

RGB -> DIN99o, normalized

RGB -> DIN99o, normalized
sourceraw docstring

to-GLHSclj

(to-GLHS c)

RGB -> GLHS

Color Theory and Modeling for Computer Graphics, Visualization, and Multimedia Applications (The Springer International Series in Engineering and Computer Science) by Haim Levkowitz

Weights: 0.2 (min), 0.1 (mid), 0.7 (max).

Ranges:

  • L: 0.0 - 1.0
  • H: 0.0 - 360.0
  • S: 0.0 - 1.0
RGB -> GLHS

Color Theory and Modeling for Computer Graphics, Visualization, and Multimedia Applications (The Springer International Series in Engineering and Computer Science) by Haim Levkowitz

Weights: 0.2 (min), 0.1 (mid), 0.7 (max).

Ranges:

* L: 0.0 - 1.0
* H: 0.0 - 360.0
* S: 0.0 - 1.0
sourceraw docstring

to-GLHS*clj

(to-GLHS* c)

RGB -> GLHS, normalized

RGB -> GLHS, normalized
sourceraw docstring

to-Grayclj

(to-Gray c)

RGB -> Grayscale

RGB -> Grayscale
sourceraw docstring

to-Gray*clj

RGB -> Grayscale

RGB -> Grayscale
sourceraw docstring

to-HCLclj

(to-HCL c)

RGB -> HCL, by Sarifuddin and Missaou.

lambda = 3.0

Returned ranges:

  • H: -180.0 - 180.0
  • C: 0.0 - 170.0
  • L: 0.0 - 135.266
RGB -> HCL, by Sarifuddin and Missaou.

lambda = 3.0

Returned ranges:

* H: -180.0 - 180.0
* C: 0.0 - 170.0
* L: 0.0 - 135.266
sourceraw docstring

to-HCL*clj

(to-HCL* c)

RGB -> HCL, normalized

RGB -> HCL, normalized
sourceraw docstring

to-HSBclj

RGB -> HSB(V), normalized (see to-HSV)

RGB -> HSB(V), normalized (see [[to-HSV]])
sourceraw docstring

to-HSB*clj

RGB -> HSB(V) (see to-HSV*)

RGB -> HSB(V) (see [[to-HSV*]])
sourceraw docstring

to-HSIclj

(to-HSI c)

RGB -> HSI

Ranges:

  • H: 0.0 - 360
  • S: 0.0 - 1.0
  • I: 0.0 - 1.0
RGB -> HSI

Ranges:

* H: 0.0 - 360
* S: 0.0 - 1.0
* I: 0.0 - 1.0
sourceraw docstring

to-HSI*clj

RGB -> HSI, normalized

RGB -> HSI, normalized
sourceraw docstring

to-HSLclj

(to-HSL c)

RGB -> HSL

Ranges:

  • H: 0.0 - 360
  • S: 0.0 - 1.0
  • L: 0.0 - 1.0
RGB -> HSL

Ranges:

* H: 0.0 - 360
* S: 0.0 - 1.0
* L: 0.0 - 1.0
sourceraw docstring

to-HSL*clj

RGB -> HSL, normalized

RGB -> HSL, normalized
sourceraw docstring

to-HSVclj

(to-HSV c)

RGB -> HSV

Ranges:

  • H: 0.0 - 360
  • S: 0.0 - 1.0
  • V: 0.0 - 1.0
RGB -> HSV

  Ranges:

* H: 0.0 - 360
* S: 0.0 - 1.0
* V: 0.0 - 1.0
sourceraw docstring

to-HSV*clj

RGB -> HSV, normalized

RGB -> HSV, normalized
sourceraw docstring

to-HunterLABclj

(to-HunterLAB c)

RGB -> HunterLAB

Returned ranges:

  • L: 0.0 - 100.0
  • a: -69.08 - 109.48
  • b: -199.78 - 55.72
RGB -> HunterLAB

Returned ranges:

* L: 0.0 - 100.0
* a: -69.08 - 109.48
* b: -199.78 - 55.72
sourceraw docstring

to-HunterLAB*clj

(to-HunterLAB* c)

RGB -> HunterLAB, normalized

RGB -> HunterLAB, normalized
sourceraw docstring

to-HWBclj

(to-HWB c)

RGB -> HWB

HWB - A More Intuitive Hue-Based Color Model by Alvy Ray Smitch and Eric Ray Lyons, 1995-1996

Ranges:

  • H: 0.0 - 360.0
  • W: 0.0 - 1.0
  • B: 0.0 - 1.0
RGB -> HWB

HWB - A More Intuitive Hue-Based Color Model
by Alvy Ray Smitch and Eric Ray Lyons, 1995-1996

Ranges:

* H: 0.0 - 360.0
* W: 0.0 - 1.0
* B: 0.0 - 1.0
sourceraw docstring

to-HWB*clj

RGB -> HWB, normalized

RGB -> HWB, normalized
sourceraw docstring

to-IgPgTgclj

(to-IgPgTg c)

RGB -> IgPgTg

Ranges:

  • Ig: 0.0 - 0.97
  • Pg: -0.35 - 0.39
  • Tg: -0.41 - 0.44
RGB -> IgPgTg

Ranges:

* Ig: 0.0 - 0.97
* Pg: -0.35 - 0.39
* Tg: -0.41 - 0.44
sourceraw docstring

to-IgPgTg*clj

(to-IgPgTg* c)

RGB -> IgPgTg*, normalized

RGB -> IgPgTg*, normalized
sourceraw docstring

to-IPTclj

(to-IPT c)

RGB -> IPT

Ranges:

  • I: 0.0 - 1.0
  • P: -0.45 - 0.66
  • T: -0.75 - 0.65
RGB -> IPT

Ranges:

* I: 0.0 - 1.0
* P: -0.45 - 0.66
* T: -0.75 - 0.65
sourceraw docstring

to-IPT*clj

(to-IPT* c)

RGB -> IPT, normalized

RGB -> IPT, normalized
sourceraw docstring

to-JABclj

(to-JAB c)

RGB -> JzAzBz

Jab https://www.osapublishing.org/oe/abstract.cfm?uri=oe-25-13-15131

Ranges:

  • J: 0.0 - 0.17
  • a: -0.09 - 0.11
  • b: -0.156 - 0.115

Reference white point set to 100.0

RGB -> JzAzBz

Jab https://www.osapublishing.org/oe/abstract.cfm?uri=oe-25-13-15131

Ranges:

* J: 0.0 - 0.17
* a: -0.09 - 0.11
* b: -0.156 - 0.115

Reference white point set to 100.0
sourceraw docstring

to-JAB*clj

(to-JAB* c)

RGB -> JzAzBz, normalized

RGB -> JzAzBz, normalized
sourceraw docstring

to-JCHclj

(to-JCH c)

RGB -> JCH

Hue based color space derived from JAB

Ranges:

  • J: 0.0 - 0.167
  • C: 0.0 - 0.159
  • H: 0.0 - 360.0
RGB -> JCH

Hue based color space derived from JAB

Ranges:

* J: 0.0 - 0.167
* C: 0.0 - 0.159
* H: 0.0 - 360.0
sourceraw docstring

to-JCH*clj

(to-JCH* c)

RGB -> JCH, normalized

RGB -> JCH, normalized
sourceraw docstring

to-LABclj

(to-LAB c)

RGB -> LAB

Returned ranges:

  • L: 0.0 - 100.0
  • a: -86.18 - 98.25
  • b: -107.86 - 94.48
RGB -> LAB

Returned ranges:

* L: 0.0 - 100.0
* a: -86.18 - 98.25
* b: -107.86 - 94.48
sourceraw docstring

to-LAB*clj

(to-LAB* c)

RGB -> LAB, normalized

RGB -> LAB, normalized
sourceraw docstring

to-LCHclj

(to-LCH c)

RGB -> LCH

Returned ranges:

  • L: 0.0 - 100.0
  • C: 0.0 - 133.82
  • H: 0.0 - 360.0
RGB -> LCH

Returned ranges:

* L: 0.0 - 100.0
* C: 0.0 - 133.82
* H: 0.0 - 360.0
sourceraw docstring

to-LCH*clj

(to-LCH* c)

RGB -> LCH, normalized

RGB -> LCH, normalized
sourceraw docstring

to-LCHuvclj

(to-LCHuv c)

RGB -> LCHuv

Returned ranges:

  • L: 0.0 - 100.0
  • C: 0.0 - 180.0
  • H: 0.0 - 360.0
RGB -> LCHuv

Returned ranges:

* L: 0.0 - 100.0
* C: 0.0 - 180.0
* H: 0.0 - 360.0
sourceraw docstring

to-LCHuv*clj

(to-LCHuv* c)

RGB -> LCHuv, normalized

RGB -> LCHuv, normalized
sourceraw docstring

to-linearclj

(to-linear v)

Gamma correction (gamma=2.4), darken

Gamma correction (gamma=2.4), darken
sourceraw docstring

to-linearRGBclj

sRGB -> linearRGB

sRGB -> linearRGB
sourceraw docstring

to-linearRGB*clj

sRGB -> linearRGB

sRGB -> linearRGB
sourceraw docstring

to-LMSclj

(to-LMS c)

RGB -> LMS, D65

Ranges: 0.0 - 100.0

RGB -> LMS, D65

Ranges: 0.0 - 100.0
sourceraw docstring

to-LMS*clj

(to-LMS* c)

RGB -> LMS, normalized

RGB -> LMS, normalized
sourceraw docstring

to-luma-color-hueclj

(to-luma-color-hue to c)

For given color space return polar representation of the color

For given color space return polar representation of the color
sourceraw docstring

to-LUVclj

(to-LUV c)

RGB -> LUV

Returned ranges:

  • L: 0.0 - 100.0
  • u: -83.08 - 175.05
  • v: -134.12 - 107.40
RGB -> LUV

Returned ranges:

* L: 0.0 - 100.0
* u: -83.08 - 175.05
* v: -134.12 - 107.40
sourceraw docstring

to-LUV*clj

(to-LUV* c)

RGB -> LUV, normalized

RGB -> LUV, normalized
sourceraw docstring

to-OHTAclj

(to-OHTA c)

RGB -> OHTA

Returned ranges:

  • I1: 0.0 - 255.0
  • I2: -127.5 - 127.5
  • I3: -127.5 - 127.5
RGB -> OHTA

Returned ranges:

* I1: 0.0 - 255.0
* I2: -127.5 - 127.5
* I3: -127.5 - 127.5
sourceraw docstring

to-OHTA*clj

(to-OHTA* c)

RGB -> OHTA, normalized

RGB -> OHTA, normalized
sourceraw docstring

to-Okhslclj

(to-Okhsl c)

sRGB -> Okhsl

Ranges:

  • h: 0.0 - 1.0
  • s: 0.0 - 1.0
  • l: 0.0 - 1.0
sRGB -> Okhsl

Ranges:

* h: 0.0 - 1.0
* s: 0.0 - 1.0
* l: 0.0 - 1.0
sourceraw docstring

to-Okhsl*clj

(to-Okhsl* c)

RGB -> Okhsl, normalized

RGB -> Okhsl, normalized
sourceraw docstring

to-Okhsvclj

(to-Okhsv c)

sRGB -> Okhsv

Ranges:

  • h: 0.0 - 1.0
  • s: 0.0 - 1.0
  • v: 0.0 - 1.0
sRGB -> Okhsv

Ranges:

* h: 0.0 - 1.0
* s: 0.0 - 1.0
* v: 0.0 - 1.0
sourceraw docstring

to-Okhsv*clj

(to-Okhsv* c)

RGB -> Okhsv, normalized

RGB -> Okhsv, normalized
sourceraw docstring

to-Okhwbclj

(to-Okhwb c)

sRGB -> Okhwb

Ranges:

  • h: 0.0 - 1.0
  • w: 0.0 - 1.0
  • b: 0.0 - 1.0
sRGB -> Okhwb

Ranges:

* h: 0.0 - 1.0
* w: 0.0 - 1.0
* b: 0.0 - 1.0
sourceraw docstring

to-Okhwb*clj

(to-Okhwb* c)

RGB -> Okhwb, normalized

RGB -> Okhwb, normalized
sourceraw docstring

to-Oklabclj

(to-Oklab c)

RGB -> Oklab

https://bottosson.github.io/posts/oklab/

  • L: 0.0 - 1.0
  • a: -0.234 - 0.276
  • b: -0.312 - 0.199
RGB -> Oklab

https://bottosson.github.io/posts/oklab/

* L: 0.0 - 1.0
* a: -0.234 - 0.276
* b: -0.312 - 0.199
sourceraw docstring

to-Oklab*clj

(to-Oklab* c)

RGB -> Oklab, normalized

RGB -> Oklab, normalized
sourceraw docstring

to-Oklchclj

(to-Oklch c)

RGB -> Oklch

RGB -> Oklch
sourceraw docstring

to-Oklch*clj

(to-Oklch* c)

RGB -> Oklch, normalized

RGB -> Oklch, normalized
sourceraw docstring

to-OSAclj

(to-OSA c)

OSA-UCS -> RGB

https://github.com/nschloe/colorio/blob/master/colorio/_osa.py

Ranges:

  • L: -13.5 - 7.14
  • j (around): -20.0 - 14.0 + some extreme values
  • g (around): -20.0 - 12.0 + some extreme values

Note that for some cases (like (to-OSA [18 7 4])) function returns some extreme values.

OSA-UCS -> RGB

https://github.com/nschloe/colorio/blob/master/colorio/_osa.py

Ranges:

* L: -13.5 - 7.14
* j (around): -20.0 - 14.0 + some extreme values
* g (around): -20.0 - 12.0 + some extreme values

Note that for some cases (like `(to-OSA [18 7 4])`) function returns some extreme values.
sourceraw docstring

to-OSA*clj

(to-OSA* c)

OSA-UCS -> RGB, normalized

Note that due to some extreme outliers, normalization is triple cubic root for g and j.

OSA-UCS -> RGB, normalized

Note that due to some extreme outliers, normalization is triple cubic root for `g` and `j`.
sourceraw docstring

to-PalettonHSVclj

(to-PalettonHSV c)
source

to-PalettonHSV*clj

(to-PalettonHSV* c)
source

to-RGBclj

Alias for to-color

Alias for [[to-color]]
sourceraw docstring

to-RGB*clj

Alias for to-color

Alias for [[to-color]]
sourceraw docstring

to-RYBclj

(to-RYB c)

RGB -> RYB

RGB -> RYB
sourceraw docstring

to-RYB*clj

RGB -> RYB, normalized

RGB -> RYB, normalized
sourceraw docstring

to-sRGBclj

(to-sRGB c)

RGB -> sRGB

RGB -> sRGB
sourceraw docstring

to-sRGB*clj

linear RGB -> sRGB

linear RGB -> sRGB
sourceraw docstring

to-UCSclj

(to-UCS c)

sRGB -> UCS

  • U: 0.0 - 0.63
  • V: 0.0 - 1.0
  • W: 0.0 - 1.57
sRGB -> UCS

* U: 0.0 - 0.63
* V: 0.0 - 1.0
* W: 0.0 - 1.57
sourceraw docstring

to-UCS*clj

(to-UCS* c)

sRGB -> UCS, normalized

sRGB -> UCS, normalized
sourceraw docstring

to-UVWclj

(to-UVW c)

sRGB -> UVW

  • U: -82.15 171.81
  • V: -87.16 70.82
  • W: -17.0 99.0
sRGB -> UVW

* U: -82.15 171.81
* V: -87.16 70.82
* W: -17.0 99.0
sourceraw docstring

to-UVW*clj

(to-UVW* c)

sRGB -> UVW, normalized

sRGB -> UVW, normalized
sourceraw docstring

to-XYBclj

(to-XYB c)

sRGB -> XYB

  • X: -0.015386116472573375 - 0.02810008316127735
  • Y: 0.0 - 0.8453085619621623
  • Z: 0.0 - 0.8453085619621623
sRGB -> XYB

* X: -0.015386116472573375 - 0.02810008316127735
* Y: 0.0 - 0.8453085619621623
* Z: 0.0 - 0.8453085619621623
sourceraw docstring

to-XYB*clj

(to-XYB* c)

sRGB -> XYB, normalized

sRGB -> XYB, normalized
sourceraw docstring

to-XYZclj

(to-XYZ c)

sRGB -> XYZ

Returned ranges (D65):

  • X: 0.0 - 95.047
  • Y: 0.0 - 100.0
  • Z: 0.0 - 108.883
sRGB -> XYZ

Returned ranges (D65):

* X: 0.0 - 95.047
* Y: 0.0 - 100.0
* Z: 0.0 - 108.883
sourceraw docstring

to-XYZ*clj

(to-XYZ* c)

sRGB -> XYZ, normalized

sRGB -> XYZ, normalized
sourceraw docstring

to-XYZ1clj

(to-XYZ1 c)

sRGB -> XYZ, scaled to range 0-1

sRGB -> XYZ, scaled to range 0-1
sourceraw docstring

to-XYZ1*clj

sRGB -> XYZ, normalized

sRGB -> XYZ, normalized
sourceraw docstring

to-YCbCrclj

(to-YCbCr c)

RGB -> YCbCr

Used in JPEG. BT-601

Ranges;

  • Y: 0.0 - 255.0
  • Cb: -127.5 - 127.5
  • Cr: -127.5 - 127.5
RGB -> YCbCr

Used in JPEG. BT-601

Ranges;

* Y: 0.0 - 255.0
* Cb: -127.5 - 127.5
* Cr: -127.5 - 127.5
sourceraw docstring

to-YCbCr*clj

(to-YCbCr* c)

RGB -> YCbCr, normalized

RGB -> YCbCr, normalized
sourceraw docstring

to-YCgCoclj

(to-YCgCo c)

RGB -> YCgCo

Ranges:

  • Y: 0.0 - 255.0
  • Cg: -127.5 - 127.5
  • Co: -127.5 - 127.5
RGB -> YCgCo

Ranges:

* Y: 0.0 - 255.0
* Cg: -127.5 - 127.5
* Co: -127.5 - 127.5
sourceraw docstring

to-YCgCo*clj

(to-YCgCo* c)

RGB -> YCgCo, normalized

RGB -> YCgCo, normalized
sourceraw docstring

to-YDbDrclj

(to-YDbDr c)

RGB -> YDbDr

Ranges:

  • Y: 0.0 - 255.0
  • Db: -340.0 - 340.0
  • Dr: -340.0 - 340.0
RGB -> YDbDr

Ranges:

* Y: 0.0 - 255.0
* Db: -340.0 - 340.0
* Dr: -340.0 - 340.0
sourceraw docstring

to-YDbDr*clj

(to-YDbDr* c)

RGB -> YDbDr

RGB -> YDbDr
sourceraw docstring

to-YIQclj

(to-YIQ c)

RGB -> YIQ

Ranges:

  • Y: 0.0 - 255.0
  • I: -151.9 - 151.9
  • Q: -133.26 - 133.26
RGB -> YIQ

Ranges:

* Y: 0.0 - 255.0
* I: -151.9 - 151.9
* Q: -133.26 - 133.26
sourceraw docstring

to-YIQ*clj

(to-YIQ* c)

RGB -> YIQ, normalized

RGB -> YIQ, normalized
sourceraw docstring

to-YPbPrclj

(to-YPbPr c)

RGB -> YPbPr

Ranges:

  • Y: 0.0 - 255.0
  • Pb: -236.6 - 236.6
  • Pr: -200.8 - 200.8
RGB -> YPbPr

Ranges:

* Y: 0.0 - 255.0
* Pb: -236.6 - 236.6
* Pr: -200.8 - 200.8
sourceraw docstring

to-YPbPr*clj

(to-YPbPr* c)

RGB -> YPbPr, normalized

RGB -> YPbPr, normalized
sourceraw docstring

to-YUVclj

(to-YUV c)

RGB -> YUV

Ranges:

  • Y: 0.0 - 255.0
  • u: -111.2 - 111.2
  • v: -156.8 - 156.8
RGB -> YUV

Ranges:

* Y: 0.0 - 255.0
* u: -111.2 - 111.2
* v: -156.8 - 156.8
sourceraw docstring

to-YUV*clj

(to-YUV* c)

RGB -> YUV, normalized

RGB -> YUV, normalized
sourceraw docstring

to-Yxyclj

(to-Yxy c)

sRGB -> Yxy

Returned ranges:

  • Y: 0.0 - 100.0
  • x: 0.15 - 0.64
  • y: 0.06 - 0.60
sRGB -> Yxy

Returned ranges:

* Y: 0.0 - 100.0
* x: 0.15 - 0.64
* y: 0.06 - 0.60
sourceraw docstring

to-Yxy*clj

(to-Yxy* c)

sRGB -> Yxy, normalized

sRGB -> Yxy, normalized
sourceraw docstring

tritanomalyclj

source

tritanopiaclj

source

valid-color?clj

(valid-color? c)

Check if given argument is valid color.

Check is done by trying to convert to color representation.

Returns color when valid.

See also possible-color?

Check if given argument is valid color.

Check is done by trying to convert to color representation.

Returns color when valid.

See also [[possible-color?]]
sourceraw docstring

wavelengthclj

(wavelength lambda)

Returns color from given wavelength in nm

Returns color from given wavelength in nm
sourceraw docstring

weighted-averageclj

(weighted-average cs weights)
(weighted-average cs weights colorspace)

Average colors with weights in given colorspace (default: :sRGB)

Average colors with weights in given `colorspace` (default: `:sRGB`)
sourceraw docstring

whitenclj

(whiten col)
(whiten col amt)

Change color towards white.

Works in HSB color space. Default amount is set to 0.2 and changes W channel by this amount.

See blacken.

Change color towards white.

Works in HSB color space. Default amount is set to 0.2 and changes W channel by this amount.

See [[blacken]].
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close