Change text colour of Shiny Dashbaord selectInput text

Viewed 287

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)
1 Answers

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.

Related