How do I add color to the header (i.e the column names) of my data frame using the gt()
function in R
gt_Head <-
gt_Head %>%
tab_header(
title = md("**Table of First 10 Observations**")
)%>%
tab_style(
style = cell_text(weight = "bold"),
locations = cells_body(
rows = 0
)
)
You can use the column_labels.background.color
option (see all options here), e.g.
library(gt)
head(mtcars, 10) |>
gt() |>
tab_header(
title = md("**Table of First 10 Observations**")
) |>
tab_options(column_labels.background.color = "blue")