2

I would like change the background color in a kable_style or the stripe.I use this :

kable(tabEvol,"latex",booktabs=TRUE)%>%
kable_styling(latex_options=c("striped","hold_positions"),stripe_color="green")

or

kable(tabEvol,"latex",booktabs=TRUE)%>%
kable_styling(latex_options=c("striped","hold_positions"))%>%
row_spec(2,background="red")

It works no problem, but if i change from the classical color, i put for example, "lightblue1", or a color from LaTeX "SkyBlue", it doesn't work anymore, i get the error message to check the xcolor package which indicate me the colors like "SkyBlue" or even RGB...

How can i do that ? put the rgb code or change the color with the name ?

Aurélien
  • 103
  • 3
  • 12

1 Answers1

1

For kableExtra 0.7, you can use any HTML hex color in row_spec. For example, row_spec(2, background = "#683659"). However, for the stripe_color option in kable_styling, the author forgot to update it with HTML color support.

Hao
  • 7,476
  • 1
  • 38
  • 59
  • Hi Hao, Does this mean one cannot specify the `stripe_color` when `kable_styling` an HTML output? – Carmen Sandoval Apr 18 '18 at 05:37
  • 1
    @gaelgarcia to your question, yes, `stripe_color` only works in LaTeX. In HTML, you should write some css by yourself. See https://stackoverflow.com/questions/49894014/how-to-specify-table-stripe-colors-for-knitrkable/49902250#49902250 – Hao Apr 18 '18 at 17:45