Reputation: 4949
Hi I'm running R studio on windows trying to generate a table in Markdown using kableExtra. Recently I notice that colors are working on one of my machine and not another.
library(knitr)
library(kableExtra)
library(Vennerable)
kable(cars, format = "latex", booktabs = T, caption = "Demo Table") %>%
kable_styling(full_width = F) %>%
column_spec(1:1, italic = T, color = "black", background = "yellow") %>%
column_spec(2, bold = T, border_right = T, background = "SpringGreen")
so this runs flawless on one of my pc but in another it give this error.
! Package xcolor Error: Undefined color `SpringGreen'.
I'm not sure of any particular reason why this is so. Anyone have a clue? thanks.
Upvotes: 0
Views: 650
Reputation: 7826
I just added HTML hex color code support to the dev version of kableExtra. If you are willing to use the dev ver, you can do things like.
kable(cars, format = "latex", booktabs = T, caption = "Demo Table") %>%
kable_styling(full_width = F) %>%
column_spec(1:1, italic = T, color = "black", background = "yellow") %>%
column_spec(2, bold = T, border_right = T, background = "#00FF7F")
(I found the hex code for springgreen
from http://latexcolor.com/)
Upvotes: 2