比方說,我有一個簡單的閃亮應用程序,我想更改側欄面板背景。我已經嘗試過使用CSS,但我只設法改變整個背景。你可以幫我嗎?R閃亮 - 側欄面板的背景
我ui.R:
library(shiny)
shinyUI(fluidPage(
includeCSS("www/moj_styl.css"),
titlePanel("Hello Shiny!"),
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
mainPanel(
plotOutput("distPlot")
)
)
))
和我server.R:
library(shiny)
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
和moj_styl.css:
body {
background-color: #dec4de;
}
body, label, input, button, select {
font-family: 'Arial';
}
我想這些是我的解決方案的鏈接:http://stackoverflow.com/questions/19777515/r-shiny-mainpanel-display-style-and-font; http://stackoverflow.com/questions/19798048/r-shiny-how-do-you-change-the-background-color-of-the-header – Benjamin
也許很高興知道''''必須被忽略並且您也可以使用十六進制顏色,例如'#003399' – 5th