彩色勾号&;sliderinput中的记号标记标签-闪亮

彩色勾号&;sliderinput中的记号标记标签-闪亮,r,shiny,R,Shiny,我想为幻灯片中的记号和记号标签提供不同的颜色,将其放入闪亮的仪表板中。例:0到5-红色,5到10-蓝色。我的代码不起作用 请检查我的密码 library(shiny) shinyApp( ui <- fluidPage( tags$style(type = "text/css", ".irs-grid-pol-left {color: red; width:50%;}", ".irs-grid-pol-right {color: blue; wid

我想为幻灯片中的记号和记号标签提供不同的颜色,将其放入闪亮的仪表板中。例:0到5-红色,5到10-蓝色。我的代码不起作用

请检查我的密码

library(shiny)
shinyApp(
  ui <- fluidPage(
    tags$style(type = "text/css", ".irs-grid-pol-left {color: red; width:50%;}",
               ".irs-grid-pol-right {color: blue; width: 50%; left: 50%;}"),
    sliderInput("bins", "Number of bins:", 1, 10, 1)
  ),
  server <- function(input, output) {}  
)
库(闪亮)
shinyApp(

ui它更像是
css
问题,而不是
R
shinny
。这应该可以完成以下工作:

library(shiny)    
shinyApp(
  ui <- fluidPage(
    tags$style(type = "text/css", 
               ".irs-grid-text:nth-child(-2n+18) {color: red}",
               ".irs-grid-text:nth-child(2n+20) {color: blue}",
               ".irs-grid-pol:nth-of-type(-n+18) {background:red}",
               ".irs-grid-pol:nth-of-type(n+18) {background:blue}"),
    sliderInput("bins", "Number of bins:", 1, 10, 1)
  ),
  server <- function(input, output) {} 
库(闪亮)
shinyApp(

ui感谢您的回答,但我需要澄清一下,这行代码是什么意思:第n个子元素(-2n+18)它选择特定的DOM元素,看一看