2016-05-23 125 views
2

我试图在shiny中自定义我的selectize input。我所拥有的是:选择闪亮的输入样式

enter image description here

而我想有是改变所选项目的颜色喜欢这里:

enter image description here

我试图改变我的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 ol“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()) 
    ) 
) 

回答

3

这是工作(只是fluidPagesidebarLayout之前)?

tags$head(
    tags$style(HTML(" 
    .item { 
     background: #2196f3 !important; 
     color: white !important; 
    } 
    .selectize-dropdown-content .active { 
     background: #2196f3 !important; 
     color: white !important; 
    } 
    ")) 
), 
+0

谢谢!这样可行。你知道要添加什么来改变字体颜色吗? – Marta

+0

我已将它更新为包含color = white,但您可以在其中添加任何有效的css颜色 –

+0

太棒了!为什么这需要“重要”?也许这是基本的,但我很新的HTML ... – Marta