I have found a few ways to apply conditional formatting based on the value of the choices. Like this example from Dean Attali:
appCSS <-
"#color ~ .selectize-control.single .selectize-dropdown [data-value=blue] { color: blue }
#color ~ .selectize-control.single .selectize-dropdown [data-value=red] { color: red }"
runApp(shinyApp(
ui = fluidPage(
tags$head(tags$style(HTML(appCSS))),
selectInput("color", "Color", c("blue", "red"))
),
server = function(input, output, session) {
}
))
However I haven't found a good way to apply formatting based on a variable that is NOT choices. My question is: suppose I have 20000 unique choices that are either in group A or B:
tibble(choices = stringi::stri_rand_strings(20000, 5), group = stri_rand_strings(20000, 1, pattern = "[AB]"))
Is there an efficient way to make all choices in group A colored in blue in the selectInput and choices in group B be red?