title: Shinydashboard - Change background based on selected tab
body: <p>I am creating a dashboard using Shinydashboard package, where I need to change the background color based on the selected Tab. I have tried the following code, but it is not working as intended.</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  library(dplyr)
  
  ui &lt;- dashboardPage(dashboardHeader(dropdownMenuOutput("notificationMenu")), 
                      dashboardSidebar(sidebarMenu(menuItem("Page 1", tabName = "page1"),
                                                   menuItem("Page 2", tabName = "page2"))),
                      dashboardBody(tags$style(".content {background-color: #f7f7f7;
              .content-wrapper .tab-pane .shiny-tab-page1 {background-color: #000000;
              }
              "),
                                    tabItems(
                        tabItem(tabName = "page1", h4("This is Page 1")),
                        tabItem(tabName = "page2", 
                                textInput("text", "Enter News:", "New News."),
                                actionButton("save", "Save")))))
  
  server &lt;- function(input, output, session){
    raw_news &lt;- reactiveValues()
  
    # Intial Header News: 1 Message from Admin
    raw_news$news &lt;- data_frame(from = "Admin", text = "this is a message")
  
    # The notifications in header
    output$notificationMenu &lt;- renderMenu({
      raw_news &lt;- raw_news$news
  
      dropdownMenu(
        messageItem(raw_news$from[1], raw_news$text[1])
      )
    })
  
    # save a new notification
    observeEvent(input$save, {
      raw_news$news &lt;- data.frame(from = "User", text = input$text)
    }) 
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>Any help will be appreciated.</p>