haozhu233 / kableExtra

Construct Complex Table with knitr::kable() + pipe.
https://haozhu233.github.io/kableExtra/
Other
686 stars 146 forks source link

Alpha < 1 in background color no longer works in column_spec() #852

Open fornaeffe opened 2 months ago

fornaeffe commented 2 months ago

Describe the bug Until a few days ago, all worked fine. Since yesterday (maybe after an update of some packages) colors specified by column_spec( background = "...") are rendered fully opaque even if I specify alpha < 1.

To Reproduce

---
title: "Test"
format: html
---

```{r}
library(kableExtra)

df <- data.frame(
  column1 = c("cell1", "cell2"),
  column2 = c("cell3", "cell4")
)

kbl(df, "html") %>%
  kable_minimal() %>%
  column_spec(1, background = "#00FF0010")

![image](https://github.com/haozhu233/kableExtra/assets/74740575/10875566-a0a7-4020-be6c-5517e5d95903)

This is my session info:

R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=Italian_Italy.utf8 LC_CTYPE=Italian_Italy.utf8 LC_MONETARY=Italian_Italy.utf8 [4] LC_NUMERIC=C LC_TIME=Italian_Italy.utf8

time zone: Europe/Rome tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] kableExtra_1.4.0

loaded via a namespace (and not attached): [1] vctrs_0.6.5 svglite_2.1.3 cli_3.6.2 knitr_1.47 rlang_1.1.4
[6] xfun_0.45 stringi_1.8.4 highr_0.11 pkgload_1.3.4 formattable_0.2.1 [11] jsonlite_1.8.8 glue_1.7.0 colorspace_2.1-0 htmltools_0.5.8.1 sass_0.4.9
[16] scales_1.3.0 rmarkdown_2.27 jquerylib_0.1.4 evaluate_0.24.0 munsell_0.5.1
[21] fastmap_1.2.0 lifecycle_1.0.4 stringr_1.5.1 compiler_4.4.1 htmlwidgets_1.6.4 [26] rstudioapi_0.16.0 systemfonts_1.1.0 digest_0.6.35 viridisLite_0.4.2 R6_2.5.1
[31] parallel_4.4.1 magrittr_2.0.3 bslib_0.7.0 tools_4.4.1 cachem_1.1.0
[36] xml2_1.3.6

dmurdoch commented 2 months ago

Your document looks like a Quarto document. Is it?

fornaeffe commented 2 months ago

Yes it is

dmurdoch commented 2 months ago

That may be your problem. kableExtra was written for R Markdown. It's gradually being adapted to also work with Quarto, but that work is not complete. Since kableExtra hasn't had a release since January, it's likely a Quarto change (or some other package) that caused the issue.