flexdashboard - change title bar color

不想你离开。 提交于 2019-11-27 22:23:01

问题


I want to change the title bar color of a flexdashboard.

I've found an example for removing it - SE here, but given that I don't know any CSS/JQuery, I had to ask.

I want to change the bar color to red, and the text to black.

Anyone?

Edit (example below):

---
title: "DB: Contact information"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---

<style>                     
.navbar {
  background-color:crimson;
  border-color:black;
}
.navbar-brand {
color:black!important;
}


</style>   


Dashboard
=====================================  

Test. Test. Test. 

Column {data-width=650}
-----------------------------------------------------------------------

### Clustered Data

Result:


回答1:


You could customize the style sheets in a <style>...</style> block like this:

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
---
<style>                     
.navbar {
  background-color:red;
  border-color:black;
}
.navbar-brand {
color:black!important;
}
</style>                    

```{r setup, include=FALSE}
library(flexdashboard)
```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
plot(0)
```

Column {data-width=350}
-----------------------------------------------------------------------

### Chart B

```{r}
plot(0)
```

### Chart C

```{r}
plot(0)
```

Or use

output: 
  flexdashboard::flex_dashboard:
    css: styles.css

to put your custom styles in a separate styles.css file.



来源:https://stackoverflow.com/questions/44305381/flexdashboard-change-title-bar-color

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!