Apply styles to a column according to CSS properties declared by expression based on data passed to grid..
Arguments
- grid
A grid created with
datagrid()
.- column
Name of column (variable name) where to apply style.
- background
Background color.
- color
Text color.
- fontWeight
Font weight, you can use
"bold"
for example.- ...
Other CSS properties.
Examples
library(toastui)
library(scales)
datagrid(mtcars) %>%
grid_style_column(
column = "mpg",
background = col_numeric("Blues", domain = NULL)(mpg),
fontWeight = "bold",
color = ifelse(mpg > 25, "white", "black")
)
datagrid(mtcars) %>%
grid_style_column(
column = "mpg",
background = col_numeric("Blues", domain = NULL)(mpg),
fontWeight = "bold",
color = ifelse(mpg > 25, "white", "black")
) %>%
grid_style_column(
column = "cyl",
background = col_bin("Blues", domain = NULL)(cyl),
fontStyle = "italic"
)