【问题标题】:How to change font color of multiInput() from shinyWidgets package如何从 shinyWidgets 包更改 multiInput() 的字体颜色
【发布时间】:2019-07-13 07:27:36
【问题描述】:

我有下面的应用程序使用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;}'))),

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

【问题讨论】:

    标签: shiny shinyapps


    【解决方案1】:

    使用这个 CSS:

    css <- "#id+div div a {color: black;}"
    
    ui <- fluidPage(
      tags$head(tags$style(css)),
      ......
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-27
      • 2019-05-19
      • 2015-05-18
      • 2011-05-20
      • 2012-02-20
      • 2011-06-19
      • 1970-01-01
      • 2021-03-09
      相关资源
      最近更新 更多