mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
72 lines
1.9 KiB
R
72 lines
1.9 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/custom_SelectInput.R
|
|
\name{colorSelectInput}
|
|
\alias{colorSelectInput}
|
|
\title{A selectizeInput customized for named vectors of color names supported by
|
|
\code{\link{generate_colors}}}
|
|
\usage{
|
|
colorSelectInput(
|
|
inputId,
|
|
label,
|
|
choices,
|
|
selected = "",
|
|
previews = 4,
|
|
...,
|
|
placeholder = ""
|
|
)
|
|
}
|
|
\arguments{
|
|
\item{inputId}{passed to \code{\link[shiny]{selectizeInput}}}
|
|
|
|
\item{label}{passed to \code{\link[shiny]{selectizeInput}}}
|
|
|
|
\item{choices}{A named \code{vector} from which fields should be populated}
|
|
|
|
\item{selected}{default selection}
|
|
|
|
\item{previews}{number of preview colors. Default is 4.}
|
|
|
|
\item{...}{passed to \code{\link[shiny]{selectizeInput}}}
|
|
|
|
\item{placeholder}{passed to \code{\link[shiny]{selectizeInput}} options}
|
|
|
|
\item{onInitialize}{passed to \code{\link[shiny]{selectizeInput}} options}
|
|
}
|
|
\value{
|
|
a \code{\link[shiny]{selectizeInput}} dropdown element
|
|
}
|
|
\description{
|
|
A selectizeInput customized for named vectors of color names supported by
|
|
\code{\link{generate_colors}}
|
|
}
|
|
\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)
|
|
}
|
|
)
|
|
}
|
|
}
|