在闪亮的仪表板上更改downloadButton()标签的颜色

时间:2018-11-06 01:55:30

标签: r shiny

将闪亮的应用程序转换为闪亮的仪表板后,我注意到下载按钮的标签变成了不容易阅读的灰色。如何设置颜色?我也可以对按钮内的图标进行同样的操作吗?

#ui.r
 library(shiny)
library(shinydashboard)
shinyUI( dashboardPage(
  dashboardHeader(
  title="Styling Download Button"
  ),
    dashboardSidebar(

      downloadButton("download1", label="Download with style", class = "butt1"),
      # style font family as well in addition to background and font color
      tags$head(tags$style(".butt1{background-color:orange;} .butt1{color: black;} .butt1{font-family: Courier New}")) 

    ),
    dashboardBody()

))
#server.r
shinyServer(function(input, output) {

})

1 个答案:

答案 0 :(得分:1)

这应该可以完成

library(shiny)
library(shinydashboard)
ui <- shinyUI( dashboardPage(
  dashboardHeader(
    title="Styling Download Button"
  ),
  dashboardSidebar(
    tags$style(type="text/css", "#download1 {background-color:orange;color: black;font-family: Courier New}"),
    downloadButton("download1", label="Download with style", class = "butt1")
  ),
  dashboardBody()
))
#server.r
server <- shinyServer(function(input, output) {})

shinyApp(ui, server)

enter image description here

相关问题