首页 > 解决方案 > 在 R Shiny 中更改 Inputwindow 的背景颜色

问题描述

我想改变控制面板的背景(你可以在哪里进行输入),但我找不到办法,我可以改变主面板的背景,但这不是我想要的。

输入示例

我接近了 .shiny-input-container,但灰色的背面仍然存在

   library(shiny)
ui <- fluidPage(
  tags$head(
    # Note the wrapping of the string in HTML()
    tags$style(HTML("
                    .shiny-input-container{ 
                    background-color: white;   
                    }
                    
                    "))
    
    ),
   titlePanel("Test"),
   sidebarLayout(
      sidebarPanel(
         sliderInput("bins",
                     "Number of bins:",
                     min = 1,
                     max = 50,
                     value = 30)
      ),
      # Show a plot of the generated distribution
      mainPanel(
         plotOutput("distPlot")
      )))
server <- function(input, output) {
   output$distPlot <- renderPlot({
      x    <- faithful[, 2] 
      bins <- seq(min(x), max(x), length.out = input$bins + 1)
      hist(x, breaks = bins, col = 'darkgray', border = 'white')
   })
}

shinyApp(ui = ui, server = server)

标签: rinputshiny

解决方案


推荐阅读