hcl_dataframe: HCL data

Description Usage Arguments Details Value Examples

View source: R/table.R

Description

These functions help you consider colors in terms of their hue, chroma, and luminance (HCL). You will need the colorspace package to run these functions.

Usage

1
2
3
hcl_dataframe(colors, background = NULL)

hcl_table(colors, background = NULL, title = NULL, decimals = 1)

Arguments

colors

character vector of R colors. Can be hex codes, etc. Names can be meaningful.

background

character R color to use as background; used for prominence calculation.

title

character title for table.

decimals

numeric number of decimal places for values in table.

Details

If you provide a background color, the prominence of each color from the background, i.e. the perceptual distance from the background, is calculated. Furthermore, hcl_table() sets the background color accordingly.

Value

hcl_dataframe()

data.frame with columns: name, color, hue, chroma luminance, prominence.

hcl_table()

An object with S3 class gt_tbl.

Examples

1
2
3
4
5
6
7
  # return data
  hcl_dataframe("red")
  hcl_dataframe("#FF0000")
  hcl_dataframe(c("red", "green"))

  # return formatted table
  hcl_table(c("red", "green"))

ijlyttle/splattr documentation built on Sept. 14, 2020, 12:04 a.m.