我需要为不同的页面设置不同的背景颜色。不幸的是,我对CSS的了解不是很强,并且在当前解决方案中,将设置为第一页的颜色分配给所有页面。
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(
title = "Shiny"
),
dashboardSidebar(
sidebarMenu(
menuItem("Section_1", tabName = "section_1", icon = icon("align-justify"),
startExpanded = TRUE, selected = TRUE),
menuItem("Section_2", tabName = "section_2", icon = icon("align-justify")),
menuItem("Section_3", tabName = "section_3", icon = icon("align-justify"))
)
),
dashboardBody(
tabItems(
tabItem("section_1",
tags$style(HTML('.content-wrapper, content{background-image: linear-gradient(45deg,#0acbdb,#7028e4)}')),
h1("TITLE 1")),
tabItem("section_2",
tags$style(HTML('.content-wrapper, content{background-color: #7028e4}'))
h1("TITLE 2")),
tabItem("section_3",h1("TITLE 3"))
)
)
)
server <- function(input, output) {}
shinyApp(ui,server)