Description Usage Arguments Value Figures Function ID See Also Examples
The cell_fill()
helper function is to be used with the tab_style()
function, which itself allows for the setting of custom styles to one or more
cells. Specifically, the call to cell_fill()
should be bound to the
styles
argument of tab_style()
.
1 |
color |
The fill color. If nothing is provided, then |
alpha |
An optional alpha transparency value for the |
A list object of class cell_styles
.
7-16
Other Helper Functions:
adjust_luminance()
,
cell_borders()
,
cell_text()
,
cells_body()
,
cells_column_labels()
,
cells_column_spanners()
,
cells_grand_summary()
,
cells_row_groups()
,
cells_stubhead()
,
cells_stub()
,
cells_summary()
,
cells_title()
,
currency()
,
default_fonts()
,
escape_latex()
,
google_font()
,
gt_latex_dependencies()
,
html()
,
md()
,
pct()
,
px()
,
random_id()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Use `exibble` to create a gt table;
# add styles with `tab_style()` and
# the `cell_fill()` helper function
tab_1 <-
exibble %>%
dplyr::select(num, currency) %>%
gt() %>%
fmt_number(
columns = vars(num, currency),
decimals = 1
) %>%
tab_style(
style = cell_fill(color = "lightblue"),
locations = cells_body(
columns = vars(num),
rows = num >= 5000)
) %>%
tab_style(
style = cell_fill(color = "gray85"),
locations = cells_body(
columns = vars(currency),
rows = currency < 100
)
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.