Dal*_*ube 3 r shiny shinydashboard
我有一个Shiny应用程序,它使用UI中Font Awesome库(内置)中的几个图标:
icon("bolt")
icon("compass")
如何更改每个图标的颜色?
您可以只使用 HTML 标签而不是使用icon()
tags$i(
class = "fa fa-check-square",
style = "color: rgb(0,166,90)"
)
Run Code Online (Sandbox Code Playgroud)
例如
library(shiny)
ui <- fluidPage(
tags$p("icon:"),
tags$hr(),
tags$i(
class = "fa fa-check-square",
style = "color: rgb(0,166,90)"
),
icon("check-square")
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
Run Code Online (Sandbox Code Playgroud)
在用户界面的开头,插入tags$style(".fa-bolt {color:#E87722}")即可更改螺栓图标的颜色。同样,添加tags$style(".fa-compass {color:#E87722}")以更改指南针图标的颜色。这会将颜色应用于应用程序中的所有螺栓图标和指南针图标。