# NOT RUN {
if (interactive()) {
library("shiny")
library("shinyWidgets")
library("scales")
ui <- fluidPage(
tags$h1("Spectrum color picker"),
br(),
spectrumInput(
inputId = "myColor",
label = "Pick a color:",
choices = list(
list('black', 'white', 'blanchedalmond', 'steelblue', 'forestgreen'),
as.list(brewer_pal(palette = "Blues")(9)),
as.list(brewer_pal(palette = "Greens")(9)),
as.list(brewer_pal(palette = "Spectral")(11)),
as.list(brewer_pal(palette = "Dark2")(8))
),
options = list(`toggle-palette-more-text` = "Show more")
),
verbatimTextOutput(outputId = "res")
)
server <- function(input, output, session) {
output$res <- renderPrint(input$myColor)
}
shinyApp(ui, server)
}
# }
Run the code above in your browser using DataLab