View source: R/gt_hulk_color.R
gt_hulk_color | R Documentation |
Apply 'hulk' palette to specific columns in a gt table. The hulk names comes from the idea of a divergin purple and green theme that is colorblind safe and visually appealing. It is a useful alternative to the red/green palette.
gt_hulk_color(gt_object, ..., domain = NULL, trim = FALSE, reverse = FALSE)
gt_object |
An existing gt table object |
... |
columns to apply color to |
trim |
trim the palette to give less intense maximal colors |
reverse |
reverse the color palette. The default is green = high and purple = low, but reverse = TRUE will make purple high and green low. |
Returns a gt table
# basic use
mtcars |>
head() |>
gt::gt() |>
gt_hulk_color(mpg)
mtcars |>
head() |>
gt::gt() |>
# trim gives small range of colors
gt_hulk_color(mpg:disp, trim = TRUE)
# option to reverse the color palette
mtcars |>
head() |>
gt::gt() |>
# trim gives small range of colors
gt_hulk_color(mpg:disp, rev = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.