Manipulate colors with 'chroma.js' library. See https://gka.github.io/chroma.js/.
new()
Create a new chroma instance.
chroma$new(color = NULL)
color
Name, hex code or a vector of length 3 (rgb) of a color.
A new 'chroma' object.
chroma.hsl()
Create a new chroma instance with HSL color.
chroma$chroma.hsl(hue, saturation, lightness)
hue
Hue parameter.
saturation
Aaturation parameter.
lightness
Lightness parameter.
A new 'chroma' object.
chroma.hsv()
Create a new chroma instance with HSV color.
chroma$chroma.hsv(hue, saturation, value)
hue
Hue parameter.
saturation
Saturation parameter.
value
Value parameter.
A new 'chroma' object.
chroma.lch()
Create a new chroma instance with LCH color.
chroma$chroma.lch(Lightness, chroma, hue)
Lightness
Lightness parameter.
chroma
Chroma parameter.
hue
Hue parameter.
A new 'chroma' object.
chroma.gl()
Create a new chroma instance with RGB color.
chroma$chroma.gl(red, green, blue, alpha = NULL)
red
Red parameter.
green
Green parameter.
blue
Blue parameter.
alpha
Alpha parameter.
A new 'chroma' object.
mix()
Mixes two colors
chroma$mix(color2, ratio = 0.5, mode = c("rgb", "hsl", "lab", "lrgb", "lch"))
color2
Name of a second color.
ratio
A value between 0 and 1.
mode
Color space used for interpolation.
A 'chroma' object modified.
average()
Average between colors
chroma$average(colors, mode = c("rgb", "hsl", "lab", "lrgb", "lch"))
colors
Color(s).
mode
Color space used for interpolation.
A 'chroma' object modified.
blend()
Blend two colors
chroma$blend( color2, type = c("multiply", "darken", "lighten", "screen", "overlay", "burn", "dodge") )
color2
Name of a second color.
blend
Blend mode.
A 'chroma' object modified.
random()
Get a random color
chroma$random()
A 'chroma' object modified.
contrast()
Contrast between two colors
chroma$contrast(color1, color2)
color1
Name of first color.
color2
Name of second color.
A 'chroma' object modified.
distance()
Distance between two colors
chroma$distance(color1, color2, mode = c("lab", "rgb", "hsl", "lrgb", "lch"))
color1
Name of first color.
color2
Name of second color.
A 'chroma' object modified.
alpha()
chroma$alpha(value = NA)
brighten()
chroma$brighten(value = 1)
darken()
chroma$darken(value = 1)
saturate()
chroma$saturate(value = 1)
desaturate()
chroma$desaturate(value = 1)
set()
chroma$set(channel, value)
get()
chroma$get(channel)
luminance()
chroma$luminance(lum = NULL, mode = "rgb")
hex()
Return color as hexadecimal
chroma$hex()
A character
.
name()
Return color's name
chroma$name()
A character
.
css()
Return color as CSS code
chroma$css()
A character
.
rgb()
Return color as RGB
chroma$rgb(round = TRUE)
A character
.
rgba()
Return color as RGBA
chroma$rgba(round = TRUE)
A character
.
hsl()
Return color as HSL
chroma$hsl()
A character
.
hsv()
Return color as HSV
chroma$hsv()
A character
.
hsi()
Return color as HSI
chroma$hsi()
A character
.
lab()
Return color as LAB
chroma$lab()
A character
.
lch()
Return color as LCH
chroma$lch()
A character
.
hcl()
Return color as HCL
chroma$hcl()
A character
.
gl()
Return color as GL
chroma$gl()
A character
.
print()
Print chroma javascript code
chroma$print()
A character
.
eval()
Evaluate chroma call in javascript
chroma$eval(type_convert = TRUE, split_char = ",")
type_convert
Convert data to appropriate type.
split_char
Character used to split results.
The result of chroma instructions.
clone()
The objects of this class are cloneable with this method.
chroma$clone(deep = FALSE)
deep
Whether to make a deep clone.
Dont initialize chroma instance with a color.
Dont initialize chroma instance with a color.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.