R shinyDashboard customize box status color

后端 未结 3 1931
野性不改
野性不改 2020-12-24 15:11

I would like to customize the color of the box status of my shiny app. I find a css way to change the box background color of these box but not to customize the status colo

3条回答
  •  天命终不由人
    2020-12-24 15:37

    I finally found the answer (long and tough but always gratifying :D)

    One of my friend (Thank you so much my friend !!!) shows me how to display all css parameters of each element of a web page (and particularly of a shiny page: go to the appropriate page and right click, something like "examine the element"!!

    So AMAZING !!

    Then, I look deeper (very very very deeper, there is so much classes !!) and I managed to access to any css parameter of the boxes !

    Here is the code for the next people :

    library(shiny)
    library(shinydashboard)
    
    ui <- dashboardPage(
      dashboardHeader(),
      dashboardSidebar(),
      dashboardBody(
        tags$style(HTML("
    
    
    .box.box-solid.box-primary>.box-header {
      color:#fff;
      background:#666666
                        }
    
    .box.box-solid.box-primary{
    border-bottom-color:#666666;
    border-left-color:#666666;
    border-right-color:#666666;
    border-top-color:#666666;
    }
    
                                        ")),
        fluidRow(
          box(width = 6, title = "youhou", status = "primary", solidHeader = TRUE,
              "Box content"
          )
        )
      )
    )
    
    
    server <- function(input, output) {}
    
    shinyApp(ui, server)
    

    Have a good week-end !!

    Cheers !

提交回复
热议问题