简体   繁体   中英

Change the color of the downloadButton() label in a shiny dashboard

After converting my shiny application to shiny dashboard I noticed that the label of the download button has turned into a grey color that is not easily read. How can I set the color of it? Can I do the same with the icon inside the button as well?

#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) {

})

This should do the job

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)

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM