我正在尝试在 shiny
中自定义我的 selectize input
。我拥有的是:
我想要的是改变所选元素的颜色,如下所示:
我试图更改我的 css
,但我设法通过添加仅更改了这个“a”颜色:
.selectize-input.input-active, .selectize-input.input-active:hover, .selectize-control.multi .selectize-input.focus {border-color: #2196f3 !important;}
.selectize-dropdown .active {background: #2196f3 !important;}
我也想更改“c”和“b”的颜色,但我不知道如何更改。你能帮帮我吗?
我的代码:
server.R
:
library("shiny")
shinyServer(function(input, output){})
ui.R
:
library("shiny")
shinyUI(fluidPage(
sidebarLayout(
sidebarPanel(
selectizeInput("select", label=NULL,
choices=c("a", "b", "c", "d"),
multiple=TRUE, options=list(placeholder="Wybierz"))),
mainPanel())
)
)
最佳答案
这是否有效(就在 fluidPage
之后和 sidebarLayout
之前)?
tags$head(
tags$style(HTML("
.item {
background: #2196f3 !important;
color: white !important;
}
.selectize-dropdown-content .active {
background: #2196f3 !important;
color: white !important;
}
"))
),
关于html - 选择 Shiny 的输入样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37386534/