rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
892 stars 300 forks source link

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

Open UOTLeop opened 6 years ago

UOTLeop commented 6 years ago

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?

bborgesr commented 6 years ago

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)
UOTLeop commented 6 years ago

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

alipprc commented 4 years ago

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