Gaurav Chaudhari
Gaurav Chaudhari

Reputation: 177

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.

Upvotes: 5

Views: 5017

Answers (1)

SeGa
SeGa

Reputation: 9809

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)

Upvotes: 8

Related Questions