【问题标题】:Change navbar theme colour permanently in bs4Dash R shiny app在 bs4Dash R 闪亮应用中永久更改导航栏主题颜色
【发布时间】:2021-08-16 11:17:07
【问题描述】:

我在闪亮的应用程序中使用 bs4Dash(版本 >2.0),但我无法将导航栏颜色(无论暗/亮主题永久更改)更改为黄色 (#ffc107)。

您可以查看?bs4Dash::skinSelector() 中给出的最小示例。虽然可以从右侧控制栏中的“导航栏主题”菜单将颜色更改为黄色,但我需要将标题颜色修复或默认为黄色。

这是 skinselecter() 中给出的最小示例。请使用来自 github 的 bs4dash 版本 > 2.0。

if (interactive()) {
 library(shiny)
 library(bs4Dash)
 
 shinyApp(
   ui = dashboardPage(
     header = dashboardHeader(),
     sidebar = dashboardSidebar(
      sidebarMenu(
       menuItem(
        text = "Item 1"
       ),
       menuItem(
        text = "Item 2"
       )
      )
     ),
     body = dashboardBody(),
     controlbar = dashboardControlbar(skinSelector(), pinned = TRUE),
     title = "Skin Selector"
   ),
   server = function(input, output) { }
 )
}

【问题讨论】:

    标签: r shiny bs4dash


    【解决方案1】:

    通过包含下面的 css,我能够解决这个问题。

    .navbar-gray-dark {
        background-color: #ffc107;         
          }
    .navbar-white {
    background-color: #ffc107; 
    }
    

    【讨论】:

    • 你把它放在哪里了?
    • at bs4Dash::dashboardHeader("title", tags$style(".navbar-gray-dark { background-color: #ffc107; } .navbar-white { background-color: #ffc107; }"))
    猜你喜欢
    • 2016-06-28
    • 2020-09-12
    • 2022-01-20
    • 1970-01-01
    • 1970-01-01
    • 2018-10-22
    • 1970-01-01
    • 1970-01-01
    • 2020-06-22
    相关资源
    最近更新 更多