[英]Change the title header color permanently in shiny dashboard
我在下面有 shiny 仪表板,我需要更改永久包含标题的 header 的颜色。 现在,当我 hover 越过它时,它就会恢复到以前的颜色。
library(DT)
ui <- dashboardPage(
dashboardHeader(title = "Dynamic sidebar"),
dashboardSidebar(
width=400
),
dashboardBody(
tags$head(tags$style(HTML('
/* logo */
.skin-blue .main-header .logo {
background-color: #E7FF6E;
}')))
)
)
server <- function(input, output) {
}
shinyApp(ui, server)
You can create a custom theme to use with {shinydashboard} with the {fresh} package, more documentation here: https://dreamrs.github.io/fresh/articles/vars-shinydashboard.html
这里以修改 header 背景颜色为例:
library(fresh)
# Create the theme
mytheme <- create_theme(
adminlte_color(
light_blue = "#E7FF6E"
)
)
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
header = dashboardHeader(title = "My dashboard"),
sidebar = dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Settings", tabName = "settings", icon = icon("sliders"))
)
),
body = dashboardBody(
use_theme(mytheme) # <-- use the theme
)
)
server <- function(input, output, session) {
}
shinyApp(ui, server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.