set_alpha: Set color's transparcy

Description Usage Arguments Value Examples

Description

Set the transparent of a color vector.

Usage

1
set_alpha(x, alpha = NA, na.rm = FALSE)

Arguments

x

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

alpha

transparency, number in [0, 1]; 0 means fully transparent, 1 means fully opaque.

na.rm

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

Value

Returns the modified color vector.

Examples

1
2
3
4
set_alpha("{ r: 1, g: 0, b: 0 }", alpha = 0.2)
set_alpha("{ h: 0.5, s: 0.5, v: 0.5 }", alpha = 0.5)
set_alpha("red", alpha = 0.6)
set_alpha("#F12", alpha = 0.7)

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