51

I am trying to change the color of the action button from gray to orange.

actionButton("run","Run Analysis")

(This is in server.R.) Is it possible to change its color?

gung - Reinstate Monica
  • 11,583
  • 7
  • 60
  • 79
Sam Kingston
  • 817
  • 1
  • 10
  • 19
  • 1
    you could use http://rstudio.github.io/shinythemes/ or possibly add tags$head() (see http://shiny.rstudio.com/articles/tag-glossary.html) in your ui.R file – MLavoie Nov 10 '15 at 00:55

3 Answers3

117

Below, I've made your action button look like a submit button (also adding a font-awesome icon):

actionButton("run", "Run Analysis", icon("paper-plane"), 
    style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
stragu
  • 1,051
  • 9
  • 15
Megatron
  • 15,909
  • 12
  • 89
  • 97
23

As @MLavoie mentioned, you can embed CSS in your shiny app using tags$head. Try this:

library(shiny)

ui <- shinyUI(fluidPage(
  tags$head(
    tags$style(HTML('#run{background-color:orange}'))
  ),
  actionButton("run","Run Analysis")
))
server <- shinyServer(function(input, output) {

})
shinyApp(ui, server)

If you're unfamiliar to CSS, w3schools has really good and easy tutorials.

Waldir Leoncio
  • 10,853
  • 19
  • 77
  • 107
RmIu
  • 4,357
  • 1
  • 21
  • 24
20

You can use boostrap colors in the class attribute:

actionButton("run","Run Analysis", class = "btn-warning")

These are basic colors only but really usefull for graphic standards.

Clemsang
  • 5,053
  • 3
  • 23
  • 41