如何更改 shinydashboard 中的侧边栏 menuItem("menu1") 字体颜色?

How to change sidebar menuItem("menu1") font color in shinydashboard?

我正在尝试更改 shinydashboard 侧边栏中 menuItem() 的文本颜色,但我的代码不起作用。

我的代码:

library(shinydashboard)

ui <- shinyUI(dashboardPage(
          dashboardHeader(title = "a"),
          dashboardSidebar(
            tags$style(HTML(".sidebar-menu li a { font-size: 100px; }")), 
            
            menuItem("first"),
            menuItem("second")
          ),
          dashboardBody(
            tags$style(HTML(".sidebar-menu li a { font-size: 100px; }")),
            tags$head(tags$style(HTML('
            .skin-blue .sidebar-menu > li.active > a {
            color:#ccff00; background-color:#ffffff
            },
            .skin-black .main-sidebar ELEMENT {
            color: #ffccdd;}
            .skin-blue .sidebar-menu > li:hover > a {font-color : #ffdd00;
              border-left-color: #ff0000 ; background-color:#ffffff;
            }'
                                      ))),
            
            "HI"
            
          )))

server <- shinyServer(function(input,output){

})

shinyApp(ui,server)

如有任何帮助,我们将不胜感激。

我已经删除了您的一些样式代码,但这应该会产生所需的颜色结果:

library(shiny)
library(shinydashboard)

ui <- shinyUI(dashboardPage(
    dashboardHeader(title = "a"),
    dashboardSidebar(
        tags$style(HTML(".sidebar-menu li a { font-size: 100px; }")), 
        
        menuItem("first"),
        menuItem("second")
    ),
    dashboardBody(
        tags$style(HTML(".sidebar-menu li a { font-size: 100px; }")),
        tags$head(tags$style(HTML('
            .skin-blue .sidebar a {
                color: #ccff00;
            }'
        ))),
        
        "HI"
        
    )))

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

shinyApp(ui,server)