3

It seems that changing the main background color and also header (navbar) background color in dark mode is not possible. per this link:

We can always change the sidebar background color in dark (or light using the function for light) mode with this function:

bs4dash_sidebar_dark(
    bg = "", 
),

However, there is no similar function for header.
Therefore, it would be useful to be able to remove or deactivate the dark/light skin switch from the header. I could not find any option to remove this toggle switch. If anyone knows how to do that, it would be highly appreciated.
Here is a simple example code:

library(shiny)
library(bs4Dash)

shinyApp(
  ui = dashboardPage(
    title = "Basic Dashboard",
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    controlbar = dashboardControlbar(),
    footer = dashboardFooter(),
    body = dashboardBody()
  ),
  server = function(input, output) {}
)

Example

Farhad
  • 151
  • 7

1 Answers1

10

Set the argument dark = NULL in dashboardPage():

library(shiny)
library(bs4Dash)

shinyApp(
  ui = dashboardPage(
    dark = NULL, 
    
    title = "Basic Dashboard",
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    controlbar = dashboardControlbar(),
    footer = dashboardFooter(),
    body = dashboardBody()
  ),
  server = function(input, output) {}
)


Mwavu
  • 1,826
  • 6
  • 14
  • Thank you very much @Mwavu. That was easy. Before I ask this question, I tried dark = FLASE which did not do the job. Appreciate your help! – Farhad Jan 30 '22 at 09:11
  • @FredS. Welcome. Consider accepting the answer to help future users of StackOverflow. – Mwavu Jan 30 '22 at 09:30
  • Thanks @Mwavu for informing me about accepting the answers. I was not in habit of accepting any answer to my questions. I learned it today and will practice it going forward. – Farhad Jan 30 '22 at 21:02