
A selectizeInput customized for named vectors of color names supported by generate_colors
Source: R/custom_SelectInput.R
colorSelectInput.RdA selectizeInput customized for named vectors of color names supported by
generate_colors
Usage
colorSelectInput(
inputId,
label,
choices,
selected = NULL,
previews = 4,
...,
placeholder = ""
)Arguments
- inputId
passed to
selectizeInput- label
passed to
selectizeInput- choices
A named
vectorfrom which fields should be populated- selected
default selection
- previews
number of preview colors. Default is 4.
- ...
passed to
selectizeInput- placeholder
passed to
selectizeInputoptions- onInitialize
passed to
selectizeInputoptions
Value
a selectizeInput dropdown element
Examples
if (shiny::interactive()) {
top_palettes <- c(
"Perceptual (blue-yellow)" = "viridis",
"Perceptual (fire)" = "plasma",
"Colour-blind friendly" = "Okabe-Ito",
"Qualitative (bold)" = "Dark 2",
"Qualitative (paired)" = "Paired",
"Sequential (blues)" = "Blues",
"Diverging (red-blue)" = "RdBu",
"Tableau style" = "Tableau 10",
"Pastel" = "Pastel 1",
"Rainbow" = "rainbow"
)
shinyApp(
ui = fluidPage(
titlePanel("Color Palette Select Test"),
colorSelectInput(
inputId = "palette",
label = "Color palette",
choices = top_palettes,
selected = "viridis"
),
verbatimTextOutput("selected")
),
server = function(input, output, session) {
output$selected <- renderPrint(input$palette)
}
)
}
#> Error: 'interactive' is not an exported object from 'namespace:shiny'