1

Is there a way to change the font and color in the YAML title in a R markdown flexdashboard? Here is the code for the YAML header I am trying to change:

---
title: "Greenhouse gases and weather data"
fontsize: 30
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
    social: menu
    source_code: embed
    theme: readable

---
SamV
  • 118
  • 1
  • 7
  • 1
    You either have to use a theme or create a CSS file. You can see the themes that are standard here: https://rmarkdown.rstudio.com/flexdashboard/using.html That site also details how to call the themes in the YAML. – Kat Mar 28 '21 at 17:47

2 Answers2

1

The other option would be to add a CSS code chunk anywhere in the dashboard

```{css}

body > div.navbar.navbar-inverse.navbar-fixed-top > div > div.navbar-header > span.navbar-brand {
  
    font-size: 26px;
    color: red;
}

```
0

as Kat said, the color is set by CSS , therefore you can change the behaviour in the .rmd file itself, or in the underlying theme template .css file.

somewhere located at:

/home/user/R/x86_64-pc-linux-gnu-library/4.0/flexdashboard/rmarkdown/templates/flex_dashboard/resources

add (to the rmd) or look for and change (the .css) to :

<style>                     
.navbar {
  background-color:white;
  border-color:blue;
}
.navbar-brand {
color:blue!important;
}
</style>  

This will revert the default color scheme of the top navbar

at the moment i dont know a simple YAML - argument solution for this ( but looking into css will gain you much more versatility along the way, than relying on the YAML options)

user12256545
  • 2,755
  • 4
  • 14
  • 28
  • Thanks Kat, user12256545 and Nata for all the hints. Nata’s solution worked out while placed in the rmd body (not in the YAML). cheers – SamV Mar 28 '21 at 22:28
  • actually yours worked too; here is another solution on stack: https://stackoverflow.com/questions/44305381/flexdashboard-change-title-bar-color?noredirect=1&lq=1 – SamV Mar 28 '21 at 22:36