Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to change the hover colour in kableExtra?

I regularly use the kable and kableExtra packages to create beautiful html tables via Rmarkdown.

A client of mine recently requested the hover colour be yellow, rather than the current shade of grey. Does anyone know if this is at all possible?

An reproducible example:

require(knitr)
require(kableExtra)
kable(mtcars, "html") %>%
  kable_styling(bootstrap_options = c("striped", "hover"))
like image 290
user2716568 Avatar asked Sep 06 '25 03:09

user2716568


1 Answers

Of course it is. Just add the following lines in your Rmd document:

<style>
.table-hover > tbody > tr:hover { 
  background-color: #f4f442;
}
</style>

Just change the color value #f4f442 to whatever your client likes.

like image 88
Martin Schmelzer Avatar answered Sep 07 '25 23:09

Martin Schmelzer