Is there a way to change the default blue header color when creating a table using pandoc in Rmarkdown

614 views Asked by At

I would like to change the color of the default table produced by pandoc in Rmarkdown. The default is blue. How can change it?

Reprex:

---
title: "reprex"
author: ""
date: ""
output: ioslides_presentation
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

## My Table

+---------------+---------------+--------------------+
| Fruit         | Price         | Advantages         |
+===============+===============+====================+
| Bananas       | $1.34         | - built-in wrapper |
|               |               | - bright color     |
+---------------+---------------+--------------------+
| Oranges       | $2.10         | - cures scurvy     |
|               |               | - tasty            |
+---------------+---------------+--------------------+

My Table

1

There are 1 answers

1
da11an On

The colors are controlled by CSS files. You can override the table header style by adding this in after your header block. I set the header background color to a green gradient below (#00FF00, #197419). Customize the colors by replacing those hex colors with your own values.

<style>
table.rmdtable th {
color: white;
font-size: 18px;
background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(40%, #00FF00), color-stop(80%, #197419)) no-repeat;
background: -webkit-linear-gradient(top, #00FF00 40%, #197419 80%) no-repeat;
background: -moz-linear-gradient(top, #00FF00 40%, #197419 80%) no-repeat;
background: -o-linear-gradient(top, #00FF00 40%, #197419 80%) no-repeat;
background: linear-gradient(top, #00FF00 40%, #197419 80%) no-repeat;
}
</style>