简体   繁体   中英

Change text colour of Shiny Dashbaord selectInput text

I have built a Shiny Dashboard and am looking to change the text colour of my selectInput text. For example, in the below code, I want to change the colour of the text 'Passing Metric' and 'Game location' to BLACK instead of WHITE. I've tried a few things but no solution so far, any help would be appreciated.

title = "Controls", solidHeader = TRUE, background = "maroon",width = 4,
                                    sidebarPanel(
                                      selectInput("select1", "Passing Metric:", 
                                                  choices = list("touchdown",
                                                                 "yards_gained",
                                                                 "third_down_converted"

                                                  )
                                      ),
                                      selectInput("select2", "Game location:",
                                                  choices = list("home",
                                                                 "away"))
                                      , width = 12)

You can add css code to your app, do this using tags$style("label{color: black;}") .

Here a reproducible example:

library(shiny)
library(shinydashboard)

tags$style("label{color: red;}")

ui <- dashboardPage(
    dashboardHeader(),
    dashboardSidebar(
        tags$style("label{color: black;}"),
        selectInput(inputId = "selecet1", label = "Passing Mectric",
                    choices = c("Touch down", "yards"))
        ),
    dashboardBody()
)

server <- function(input, output) { }

shinyApp(ui, server)

Read the documentation in order to learn more about this.

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