r - 如何在 RSTudio 中为 Flex 仪表板选项卡的标签选择颜色?

标签 r tabs flexdashboard

我正在使用 Flex 仪表板工具来创建仪表板。仪表板有几个选项卡。我想知道如何将颜色应用于选项卡的标题/名称/标签。谢谢!

代码如下:

---
title: "A Template of Dashboard with Pages and Tabs"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    social: [ "twitter", "facebook", "menu" ]

---

<style>
body {
  background-color: lightgray;
  color: black; 
}

.nav-tabs-custom > .nav-tabs > li.active {border-top-color: black; }


.tabset { 
  background-color: red;
  border: 10px solid green !important;

}

</style>



## Column {data-width=120}



## Column {data-width=880 .tabset}


### Tab 1



### Tab 2


最佳答案

这可以像这样实现:

---
title: "A Template of Dashboard with Pages and Tabs"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    social: [ "twitter", "facebook", "menu" ]
---

```{css}
/* Set font color of inactive tab to green */
.nav-tabs-custom .nav-tabs > li > a {
  color: green;
} 

/* Set font color of active tab to red */
.nav-tabs-custom .nav-tabs > li.active > a {
  color: red;
} 

/* To set color on hover */
.nav-tabs-custom .nav-tabs > li.active > a:hover {
  color: purple;
}
```


## Column {data-width=120}



## Column {data-width=880 .tabset}


### Tab 1



### Tab 2

enter image description here

关于r - 如何在 RSTudio 中为 Flex 仪表板选项卡的标签选择颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62186641/

相关文章:

r - 从 R 中的字符串到 DataFrame 的词频

r - ChartSeries - 如何将绘图 x 标签设置为数据框中的原始日期

javascript - 如何将 JavaScript 函数的结果加载到新选项卡

r - 更新到 R 版本 3.4.2 后,pandoc 文档转换失败,错误 1

r - 当 j 的整体结果无论如何都是列表时,我们是否需要将 j 的单个元素转换为列表?

r - 在 OS X Yosemite 上安装 RODBC

bash - 在多个(新)选项卡中打开现有 Gvim 中的文件

javascript - Ionic 选项卡 View 状态提供者空白 View

r - 将 Google Analytics 脚本添加到 R flexdashboard 中

r - flexdashboard 导航栏中的下载按钮