Change the color tone of a shinytheme

眉间皱痕 提交于 2021-01-28 19:33:41

问题


Friends, is it possible to change the color tone of a shinytheme used? In my case I am using "united" which uses orange and gray. However I would like to make a slightly darker orange, is it possible to make this change? If so, can you please help me? The executable code is below.

library(shinyBS)
library(shiny)
library(shinyjs) 

ui <- fluidPage(
  navbarPage(theme = shinytheme("united"), collapsible = TRUE,
  titlePanel("Old Faithful Geyser Data"),

  sidebarLayout(
    sidebarPanel( 
      radioButtons("filter1", h3("Select properties"),
                   choices = list("All properties" = 1, 
                                  "Exclude properties" = 2),
                   selected = 1),
      title= "Select Proprierties",
      radioButtons("filter2", h3("Select farms"),
                   choices = list("All farms" = 1, 
                                  "Exclude farms" = 2),
                   selected = 1),
      sliderInput("bins",
                  "Number of bins:",
                  min = 1,
                  max = 20,
                  value = 30),
      ## need to include at least one bs element, adapt
      bsTooltip("bins", "The wait times will be broken into this many equally spaced bins",
                "right", options = list(container = "body")) 

    ),

    mainPanel(
      plotOutput("distPlot")
    )
  )
))

## use JS to add an id attribute to the elements where you want to add the popover
add_id_js <- paste0(
  "$('#filter1').find('.radio > label').attr('id', function(i) {",
  "return 'filter1_row_' + i})")

server <- function(input, output, session) {
  ## once the UI is loaded, call JS function and attach popover to it
  session$onFlushed(function() {
    runjs(add_id_js)
    addPopover(session, "filter1_row_0", "My Popover", "Content")

  })


  output$distPlot <- renderPlot({
    # generate bins based on input$bins from ui.R
    x    <- faithful[, 2]
    bins <- seq(min(x), max(x), length.out = input$bins + 1)

    # draw the histogram with the specified number of bins
    hist(x, breaks = bins, col = 'darkgray', border = 'white')
  })
}

# Run the application 
shinyApp(ui = ui, server = server)

Thank you very much friends!!

来源:https://stackoverflow.com/questions/61782359/change-the-color-tone-of-a-shinytheme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!