shinydashboard icon indicating copy to clipboard operation
shinydashboard copied to clipboard

Might us change the black ground color for the siderbar and the main body part?

Open UOTLeop opened this issue 8 years ago • 3 comments

When I want to change the background color of the side bar or the main body, I need to write a css file to replace the date. Could you please give us some parameters to change the blackground color for different part?

UOTLeop avatar Sep 29 '17 15:09 UOTLeop

We may actually add a color argument to the dashboardBody() and dashboardSidebar() functions in the future. However, I haven't started working on that yet (should happen in the next couple of months). So, I'll leave this issue open and close it once this functionality exists.

However, the shinythemes package might be of interest to you, since it allows you to change the color scheme (there's 16 different ones) with just one line in your UI function.

Even if you don't go that way, there is no need to add a css file if you just want to replace the background colors. You do this inline in your UI function using tags$head( tags$style( HTML(" ... ") ) ):

library(shinydashboard)
library(shiny)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    tags$head(
      tags$style(HTML("
          .content-wrapper {
            background-color: linen !important;
          }
          .main-sidebar {
            background-color: powderblue !important;
          }
        "))
    )
  )
)

server <- function(input, output, session) { }

shinyApp(ui, server)

bborgesr avatar Sep 29 '17 16:09 bborgesr

Appreciate for your suggestions :). I have added one css file in my background to resolve the question.

UOTLeop avatar Oct 02 '17 14:10 UOTLeop

If you have something in sidebar, how you could change the font color as well in order to be visible since the default color is white

alipprc avatar Mar 26 '20 15:03 alipprc