【问题标题】:change fileinput progress bar color to gradient in R shiny在R闪亮中将fileinput进度条颜色更改为渐变
【发布时间】:2019-11-30 01:03:06
【问题描述】:

无法将渐变颜色添加到我的文件输入进度条。

现在,我可以使用此处提供的代码将进度条的颜色从常规的蓝色更改为其他颜色。 Colour of progress bar in fileInput -- Shiny

ui <- fluidPage(

    tags$head(tags$style(".progress-bar{background-color:#3c763d;}")),

    fileInput(inputId = "fileInp", label = "Input file:",multiple = FALSE,
               accept = c(
                 "text/csv",
                 "text/comma-separated-values,text/plain",
                 ".csv"))

  )


  server <- function(input, output){


  }

  shinyApp(ui=ui, server=server)


##also tried replacing background color with code from https://www.w3schools.com/css/css3_gradients.asp but no luck :


  background-color: linear-gradient(to right, red , yellow);

但是,我想要的是像这样的渐变https://imgur.com/XdFBUIt

【问题讨论】:

    标签: r shiny rstudio shiny-server rstudio-server


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      要在 CSS 中设置渐变,属性是 background-image,而不是 background-color。您还必须将background-size 设置为auto,否则设置为40px 40px 并且进度条是条纹的。这是 CSS:

        tags$head(
          tags$style(
            ".progress-bar {
                background-image: linear-gradient(to right, red , yellow) !important;
                background-size: auto !important;
            }")
        )
      

      【讨论】:

        猜你喜欢
        • 2017-11-08
        • 2020-06-22
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-11-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多