1

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

yuliaUU
  • 1,581
  • 2
  • 12
  • 33
  • I know I can add teh following to markdown: . But I know it is not a good practice to do so – yuliaUU Feb 23 '21 at 01:13
  • 2
    looks like [set_flextable_defaults(extra_css = "caption { color: #000; }")](https://github.com/davidgohel/flextable/blob/9947fbef2623b6491fea544cd66eb06eea5caf2a/R/defaults.R#L23) is the way, but it doesn't change anything – rawr Feb 23 '21 at 01:27
  • thanks, @rawr, I have made a bug report for this issue. hope it will be an easy fix – yuliaUU Feb 23 '21 at 04:09

1 Answers1

3

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)

yuliaUU
  • 1,581
  • 2
  • 12
  • 33