如何创建自定义 Shinydashboard 皮肤

Gau*_*ari 3 r shinydashboard

我正在制作闪亮的仪表板,希望皮肤上的颜色与闪亮文档中可用的颜色不同(闪亮的皮肤可用

我想要 ('#2666cc','rgb(38, 102, 204)') 这种皮肤颜色。有可能在闪亮的仪表板上吗?

仪表盘

想要高亮区域的新颜色。

SeG*_*eGa 5

在您发布的链接中,有一个 CSS 部分,它解释了所有内容。但首先,这应该没问题:)

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)
Run Code Online (Sandbox Code Playgroud)