简体   繁体   中英

How to create Custom Shinydashboard skin

I am working on shiny dashboard and want some different color on skin than colors which are available in shiny documentation ( skins available in shiny )

I want ('#2666cc','rgb(38, 102, 204)') this color on skin. is it possible in shiny dashboard?

Dashboard

Want new color in highlighted area.

In the link you posted, there is a CSS section, which explains everything. But for a start this should be fine :)

library(shinydashboard)

ui <- dashboardPage(
  dashboardHeader(title = "Custom font"),
  dashboardSidebar(
    # Custom CSS to hide the default logout panel
    tags$head(tags$style(HTML('.logo {
                              background-color: #2666cc !important;
                              }
                              .navbar {
                              background-color: #2666cc !important;
                              }
                              '))),

    # The dynamically-generated user panel
    uiOutput("userpanel")
  ),
  dashboardBody()
)

server <- function(input, output, session) {
  output$userpanel <- renderUI({
    # session$user is non-NULL only in authenticated sessions
    if (!is.null(session$user)) {
      sidebarUserPanel(
        span("Logged in as ", session$user),
        subtitle = a(icon("sign-out"), "Logout", href="__logout__"))
    }
  })
}

shinyApp(ui, server)

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