2015-11-09 74 views
16

我正在尝试将动作按钮的颜色从灰色更改为橙​​色。更改闪亮的动作按钮的颜色

actionButton("run","Run Analysis") 

(这是server.R)是否有可能改变其颜色?

+0

你可以使用http://rstudio.github.io/shinythemes/或者可能添加标签$ head()(请参阅http://shiny.rstudio.com/articles/tag-glossary.html)在你的ui.R文件中 – MLavoie

回答

10

正如@MLavoie提到你可以使用你的tags$head闪亮的应用程序中嵌入CSS,试试这个:

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) 

如果你不熟悉CSS,W3Schools的具有真正的好和易于教程。

39

下面,我做你的动作按钮看起来像一个提交按钮(还加入了font-awesome icon):

actionButton("run", "Run Analysis", icon("paper-plane"), 
    style="color: #fff; background-color: #337ab7; border-color: #2e6da4") 
+0

任何想法允许哪些图标?我尝试了'保存'“fa-floppy-o”,但没有显示。 –

+1

你是如何编码的?作为'icon(“floppy-o”)'? – Megatron

+0

完成,谢谢,我将它编码为'“fa-floppy-o”',但是它的工作方式如同''floppy-o' –