![](/img/trans.png)
[英]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.