Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

setSliderColor

Color editor for sliderInput


Description

Edit the color of the original shiny's sliderInputs

Usage

setSliderColor(color, sliderId)

Arguments

color

The color to apply. This can also be a vector of colors if you want to customize more than 1 slider. Either pass the name of the color such as 'Chartreuse ' and 'Chocolate 'or the HEX notation such as '#7FFF00' and '#D2691E'.

sliderId

The id of the customized slider(s). This can be a vector like c(1, 2), if you want to modify the 2 first sliders. However, if you only want to modify the second slider, just use the value 2.

Note

See also https://www.w3schools.com/colors/colors_names.asp to have an overview of all colors.

See Also

See chooseSliderSkin to update the global skin of your sliders.

Examples

if (interactive()) {

library(shiny)
library(shinyWidgets)

ui <- fluidPage(

  # only customize the 2 first sliders and the last one
  # the color of the third one is empty
  setSliderColor(c("DeepPink ", "#FF4500", "", "Teal"), c(1, 2, 4)),
  sliderInput("obs", "My pink slider:",
              min = 0, max = 100, value = 50
  ),
  sliderInput("obs2", "My orange slider:",
              min = 0, max = 100, value = 50
  ),
  sliderInput("obs3", "My basic slider:",
              min = 0, max = 100, value = 50
  ),
  sliderInput("obs3", "My teal slider:",
              min = 0, max = 100, value = 50
  ),
  plotOutput("distPlot")
)

server <- function(input, output) {

  output$distPlot <- renderPlot({
    hist(rnorm(input$obs))
  })
}

shinyApp(ui, server)

}

shinyWidgets

Custom Inputs Widgets for Shiny

v0.6.0
GPL-3
Authors
Victor Perrier [aut, cre, cph], Fanny Meyer [aut], David Granjon [aut], Ian Fellows [ctb] (Methods for mutating vertical tabs & updateMultiInput), Wil Davis [ctb] (numericRangeInput function), Spencer Matthews [ctb] (autoNumeric methods), JavaScript and CSS libraries authors [ctb, cph] (All authors are listed in LICENSE.md)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.