是否可以在 kableExtra 中使用具有多列背景颜色的悬停?

Is it possible to use hover with multiple column background colors in kableExtra?

我想指定列颜色,但是当我将鼠标悬停在它们上方时,仍然能够突出显示特定行。即,当鼠标悬停在一行上时,颜色会发生变化。

在这个例子中,当鼠标悬停在上面时,带有颜色的两列不会发生变化。我也希望他们改变。

require(knitr)
require(kableExtra)
kable(mtcars, "html") %>%
  kable_styling(bootstrap_options = c("striped", "hover")) %>%
  column_spec(2, color = "white",
              background = "#ADD8E6") %>%
  column_spec(3, color = "white",
              background = "#ADBCE6")

将此代码放入您的 Rmd 文件中,将鼠标悬停在上方时会出现所选颜色,如下所示:

---
title: "Sales - YtD 2020"
output: 
  flexdashboard::flex_dashboard:
  runtime: shiny       
---

```{r setup, include=FALSE}
library(flexdashboard)

```

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

Sales
=======================================================================

Row 
-----------------------------------------------------------------------

### Your dashboard output