如何从ShinyWidgets包更改multiInput()的字体颜色

时间:2019-07-13 07:27:36

标签: shiny shinyapps

我下面的应用使用shinyWidgets软件包

library(shinyWidgets); library("shiny")
ui <- fluidPage(
  multiInput(
    inputId = "id", label = "Fruits :",
     choices = c("Banana", "Blueberry", "Cherry",
                "Coconut", "Grapefruit", "Kiwi",
                "Lemon", "Lime", "Mango", "Orange",
                "Papaya"),
    selected = "Banana", width = "400px",
     options = list(
       enable_search = FALSE,
       non_selected_header = "Choose between:",
      selected_header = "You have selected:"
    )
   ),
   verbatimTextOutput(outputId = "res")
 )

 server <- function(input, output, session) {
   output$res <- renderPrint({
     input$id
  })
 }

shinyApp(ui = ui, server = server)

是否可以进一步自定义此设置。特别是我想将所有选择的字体颜色更改为 Black 。我在下面添加了一行,但是它无法更改字体颜色

tags$head(tags$style(HTML('#id {color:#000 !important;}'))),

任何指针都将受到高度赞赏。

1 个答案:

答案 0 :(得分:0)

使用此CSS:

css <- "#id+div div a {color: black;}"

ui <- fluidPage(
  tags$head(tags$style(css)),
  ......