rr-markdownflextablereadable

How to change a color of table's caption when knitting?


I was wondering whether there is an easy way to change the colour of the flextable table caption without the use of CSS?

---
title: "Test"
output:
  html_document:
    highlight: tango
    theme: readable
---

```{r}
library(flextable)
library(tidyr)
```

```{r}
flextable(iris[1:6,]) %>%  set_caption(caption = "Iris Dataset")  
```

Here is my output: I would like to have a table title in black enter image description here


Solution

  • so I asked the flextable developer team and they suggest using:

    ```{css}
    caption {
      color:red;
    }
    ```
    

    which is not really a solution as I cant for example set a different header for different tables, and it requires the use of CSS ( which is a bad practice to add it into the rmd document)