【发布时间】:2020-01-01 19:07:34
【问题描述】:
我想在我的 selectizeInput 选项中为组名着色。下拉菜单中的“水果”一词应始终为橙色,而“年份”应为绿色。
我已经尝试过在网上找到的方法,但无法完全弄清楚。附件是一个改编自Selectize Input style in Shiny (font color of selected items)的Shiny应用示例。
library(googleVis)
shinyApp(
ui = fluidPage(
tags$head(
tags$style(HTML("
.selectize-dropdown-content[data-value=\"Fruit\"]{
color: orange !important;
}
.selectize-dropdown-content[data-value=\"Year\"]{
color: blue !important;
}
"))
), uiOutput("type")),
server = function(input, output, session) {
output$type <- renderUI({
selectInput("color", "Color",as.list(Fruits), multiple = T)
})
}
)
【问题讨论】: