【发布时间】:2020-05-13 18:39:13
【问题描述】:
朋友们,可以改变使用的闪亮主题的色调吗?就我而言,我使用的是橙色和灰色的“联合”。但是我想做一个稍微深一点的橙色,可以做这个改变吗?如果是这样,你能帮帮我吗?可执行代码如下。
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)
非常感谢各位朋友!!
【问题讨论】:
-
我不使用 R,但您似乎可以通过 CSS 做到这一点。检查此链接以查看它是否对您有任何帮助。 rstudio.github.io/shinydashboard/appearance.html#skins :)
-
主题的
www部分似乎有 CSS 样式?我会从那里开始。
标签: r shiny shinythemes