Change navbar theme colour permanently in bs4Dash R shiny app

824 Views Asked by At

I am using bs4Dash (version >2.0) in a shiny app but I am unable to change the navbar color (change permanently irrespective of the dark/light theme) to yellow (#ffc107).

You can check the minimal example given in ?bs4Dash::skinSelector(). While the colour can be changed to yellow from 'Navbar themer' menu in the right control bar but I need to fix or default the header colour to yellow.

Here this is the minimal example given in skinselecter(). please use bs4dash version > 2.0 from github.

if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 shinyApp(
   ui = dashboardPage(
     header = dashboardHeader(),
     sidebar = dashboardSidebar(
      sidebarMenu(
       menuItem(
        text = "Item 1"
       ),
       menuItem(
        text = "Item 2"
       )
      )
     ),
     body = dashboardBody(),
     controlbar = dashboardControlbar(skinSelector(), pinned = TRUE),
     title = "Skin Selector"
   ),
   server = function(input, output) { }
 )
}
1

There are 1 best solutions below

2
On BEST ANSWER

By including below css, i was able to solve this.

.navbar-gray-dark {
    background-color: #ffc107;         
      }
.navbar-white {
background-color: #ffc107; 
}