【问题标题】:Change color in Shiny Dashboard for menuSubItem在 Shiny Dashboard 中更改 menuSubItem 的颜色
【发布时间】:2019-03-08 09:09:32
【问题描述】:

我对菜单子项的颜色有疑问。
颜色首先覆盖所有子项(图1),字体颜色为灰色。
当我悬停时,顶部菜单项是黑色的(图 2)。

目前有效的是改变子菜单的背景颜色:

.skin-red .main-sidebar .sidebar .sidebar-menu .treeview-menu {
    background-color: #FDFDFD;
}

我尝试了以下变化:

.skin-red .main-sidebar .sidebar .sidebar-menu .treeview-menu a {
    color: #8e44ad;
}   

.skin-red .main-sidebar .sidebar .sidebar-menu .treeview-menu a:hover {
    color: #8e44ad;
}   

选择子菜单:

选中子菜单并将其悬停在该区域中:

感谢您的帮助!

【问题讨论】:

  • 我改进了文本和代码格式、嵌入图像(为了更好的可读性和希望更多的答案)
  • 非常感谢!我是这个社区的新手,也是 R 的新手 :) 我不能自己做,因为我需要 15 分或某事。用于嵌入图像;)

标签: r submenu shinydashboard


【解决方案1】:

我知道这个问题已经过时了,但我只是在尝试解决同样的问题时遇到了这个问题。在我的案例中起作用的是在dashboardSidebar部分添加以下关于.treeview-menu的标签。

dashboardSidebar(width = 260,
    # ...sidebar items and other tags I need
        tags$style(HTML(".main-sidebar .sidebar .sidebar-menu .treeview-menu li.active a {background-color: #1E282C !important;}")),
        tags$style(HTML(".main-sidebar .sidebar .sidebar-menu .treeview-menu li:hover a {background-color: #1E282C !important;}"))
    # ...some other tags I need
)

我希望这会有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-02-11
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 2019-07-28
    • 2020-11-25
    • 2021-08-31
    • 1970-01-01
    相关资源
    最近更新 更多