1

我想在 Rmarkdown 中更改 pandoc 生成的默认表的颜色。默认为蓝色。怎么可能改变呢?

代表:

---
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            |
+---------------+---------------+--------------------+

我的桌子

4

1 回答 1

1

颜色由 CSS 文件控制。您可以通过在标题块之后添加它来覆盖表格标题样式。我将标题背景颜色设置为下方的绿色渐变(#00FF00,#197419)。通过用您自己的值替换这些十六进制颜色来自定义颜色。

<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>
于 2020-12-10T15:39:04.217 回答