【问题标题】:Is there a way to change the default blue header color when creating a table using pandoc in Rmarkdown在 Rmarkdown 中使用 pandoc 创建表格时,有没有办法更改默认的蓝色标题颜色
【发布时间】:2020-12-10 14:55:30
【问题描述】:

我想在 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            |
+---------------+---------------+--------------------+

【问题讨论】:

    标签: r r-markdown pandoc ioslides


    【解决方案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>
    

    【讨论】:

    • 谢谢。我将以下内容添加到 CSS 中并且它有效。我错过了覆盖默认 pandoc 设置所需的 !importantth { background: #041E42 !important; border-color: #EDE7DD !important; }
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-26
    • 2012-01-15
    • 1970-01-01
    • 2015-09-21
    • 1970-01-01
    相关资源
    最近更新 更多