我只需要将整个表格的背景颜色更改为白色。一个可重现的例子
kable(head(iris)) %>%
kable_styling("striped", full_width = FALSE, htmltable_class = 'lightable-classic-2') %>%
add_header_above(c("Measurements" = 4L, " " = 1L)) %>%
kable_paper() %>%
save_kable(file = 'tableX.png')
发现/尝试了什么:
add_header_above()
有一个背景参数,但只影响标题。save_kable()
有 bs_theme
参数,但我找不到选项是什么。extra_css
参数,但找不到影响整个表的函数。答案 0 :(得分:2)
您可以在 bootswatch.com 找到一些 bs_theme
示例
对于我的示例,我使用了 flatly
。
library(kableExtra)
kable(head(iris)) %>%
kable_styling("striped", full_width = FALSE, htmltable_class = 'lightable-classic-2') %>%
add_header_above(c("Measurements" = 4L, " " = 1L)) %>%
kable_paper() %>%
save_kable(file = 'tableX.png', bs_theme = "flatly")