csscolor: Generate CSS-compatible color strings

Description Usage Arguments Value Examples

View source: R/style.R

Description

Generate CSS-compatible color strings

Usage

1
csscolor(x, format = c("auto", "hex", "rgb", "rgba"), use.names = TRUE)

Arguments

x

color input

format

the output format of color strings

use.names

logical of whether to preserve the names of input

Value

a character vector of CSS-compatible color strings

Examples

1
2
3
4
csscolor(rgb(0, 0.5, 0.5))
csscolor(c(rgb(0, 0.2, 0.2), rgb(0, 0.5, 0.2)))
csscolor(rgb(0, 0.5, 0.5, 0.2))
csscolor(gradient(c(1,2,3,4,5), "white", "red"))

Example output

[1] "#008080"
[1] "#003333" "#008033"
[1] "rgba(0, 128, 128, 0.2)"
[1] "#ffffff" "#ffbfbf" "#ff7f7f" "#ff3f3f" "#ff0000"

formattable documentation built on Jan. 13, 2021, 7:17 a.m.