How can I choose colors for labels of flex dashboard tabs in RSTudio?

Viewed 581

I am using the flex dashboard tool to create a dashboard. The dashboard has a few tabs. I am wondering how I can apply colors to the titles/names/labels of the tabs. Thanks!

The following is the code:

---
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


1 Answers

This can be achieved like so:

---
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

Related