manipulate_col: Manipulate the color

Description Usage Arguments Details Value Examples

Description

Function of manipulate the color's lightness, brightness, darkness, desaturate, saturate.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
manipulate_col(x, methods, amount, tohex8)

col_lighten(x, amount = 10, tohex8 = TRUE, na.rm = FALSE)

col_brighten(x, amount = 10, tohex8 = TRUE, na.rm = FALSE)

col_darken(x, amount = 10, tohex8 = TRUE, na.rm = FALSE)

col_desaturate(x, amount = 10, tohex8 = TRUE, na.rm = FALSE)

col_saturate(x, amount = 10, tohex8 = TRUE, na.rm = FALSE)

col_grey(x, tohex8 = FALSE, na.rm = FALSE)

Arguments

x

a any type color string or a javascript color object specifying.

amount

Amount of manipulate the color, from 0 to 100.

tohex8

convert the return value to 8-bit hex color.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

method

The methods will manipulate.

Details

'col_lighten' lighten the color a given amount, from 0 to 100. Providing 100 will always return white. 'col_brighten' brighten the color a given amount, from 0 to 100. 'col_darken' darken the color a given amount, from 0 to 100. Providing 100 will always return black. 'col_saturate' desaturate the color a given amount, from 0 to 100. Providing 100 will is the same as calling greyscale. 'col_desaturate' saturate the color a given amount, from 0 to 100. 'col_grey' completely desaturates a color into greyscale. Same as calling desaturate(100). 'col_spin' spin the hue a given amount, from -360 to 360. Calling with 0, 360, or -360 will do nothing (since it sets the hue back to what it was before).

Value

Returns the modified color vector.

Examples

1
2
3
4
5
6
7
col_lighten("red")
col_brighten("green", amount = 40)
col_darken("blue", amount = 30)
col_saturate("hsl(0, 10%, 50%)")
col_desaturate("hsl(0, 40%, 50%)")
col_grey("red")
hue_spin("#F00", amount = 90)

houyunhuang/tinycolor documentation built on June 6, 2019, 7:43 p.m.