Change cell font color in Kable using kableextra, in pdf rmarkdown xelatex

Viewed 199

do you know if there is anyway to change the font color of a kable table cell.

it is very important for me to do it with kable or kableextra because I need a stripped table, with some bold columns or rows, but I also need some cells to be in another color. This is the code I would like to extend not to modify if possible

library(kableExtra)

x_latex <- knitr::kable(head(mtcars), "latex", booktabs=T, col.names = NULL)
#kable_styling(x_latex, latex_options = "striped", position = "float_left")
kable_styling(x_latex, latex_options = c("striped","HOLD_position"), stripe_color = "gray!13") %>%
sub("\\\\toprule", "", .) %>%
sub("\\\\bottomrule", "", .)  %>% row_spec(2,bold=TRUE)

now lets say rows 1, 1 and 2, 2 need to be red, how could I achieve this? Can I use cell_spec?

Thanks in advance.

0 Answers
Related