Here is an example using exibble
dataset from gt
package.
As you can find here in the documentation https://gt.rstudio.com/reference/tab_options.html we could use heading.background.color
argument:
library(gt)
library(dplyr)
tab_1 <-
exibble %>%
dplyr::select(-c(fctr, date, time, datetime)) %>%
gt(
rowname_col = "row",
groupname_col = "group"
) %>%
tab_options(
heading.background.color = "#eebf00",
heading.border.bottom.color = "#eebd00",
heading.border.bottom.width = "5px",
heading.border.lr.color = "#aae100",
heading.border.lr.width = "50px", #no effect
) %>%
tab_header(
title = md("Data listing from **exibble**"),
subtitle = md("`exibble` is an R dataset")
) %>%
fmt_number(columns = num) %>%
fmt_currency(columns = currency) %>%
tab_footnote(
footnote = "Using commas for separators.",
locations = cells_body(
columns = num,
rows = num > 1000
)
) %>%
tab_footnote(
footnote = "Using commas for separators.",
locations = cells_body(
columns = currency,
rows = currency > 1000
)
) %>%
tab_footnote(
footnote = "Alphabetical fruit.",
locations = cells_column_labels(columns = char)
)
tab_1
