The color of the strips are very lite on Kable
on Pdf output. So is there a way to change the color on kable_styling(latex_options = "striped")
?
The author of the kableExtra
package @hao was kind to add this option. The answer can be found on change the strip color on kableExtra
Cobbling together the link provided by @S.Perera above (where @hao states no functionality for hex codes yet), deciding I didn't like the available LaTeX color codes found here (code for modifying just below that), an attempt to change stripe color described here, and my own desire to fine-tune with hex codes, I came up with the following:
In the YAML:
---
output:
pdf_document:
latex_engine: xelatex
header-includes: \definecolor{ltgray}{HTML}{D3D3D3}
---
ltgray
is the new name for the color, HTML
is the model (you can also do RGB or CMYK), and D3D3D3
is the hex code for the color I want. Assuming my dataframe for the table is called df
:
kable(df, format = "latex", booktabs=TRUE) %>%
kable_styling(latex_options = "striped", stripe_color="ltgray")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With