将文件输入进度条颜色更改为 R shiny 中的渐变
change fileinput progress bar color to gradient in R 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
尝试从预定义的调色板创建色带:
https://www.rdocumentation.org/packages/dichromat/versions/1.1/topics/colorRampPalette
要在 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;
}")
)
在我的文件输入进度条中添加渐变颜色时遇到问题。
现在,我可以使用此处提供的代码将进度条的颜色从常规蓝色更改为其他颜色。
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
尝试从预定义的调色板创建色带: https://www.rdocumentation.org/packages/dichromat/versions/1.1/topics/colorRampPalette
要在 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;
}")
)