[英]Is there a way to add color to borders of table using kable extra in rmarkdown pdf?
[英]Is there a way to change the default blue header color when creating a table using pandoc in Rmarkdown
我想在 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 |
+---------------+---------------+--------------------+
colors 由 CSS 文件控制。 您可以通过在 header 块之后添加它来覆盖表 header 样式。 我将 header 背景颜色设置为下方的绿色渐变(#00FF00,#197419)。 通过将这些十六进制 colors 替换为您自己的值来自定义 colors。
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.