在Shiny Dashboard中为menuSubItem更改颜色

问题描述 投票:1回答:1

菜单子项的颜色有问题。 颜色首先遍布所有子项(图片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;
}   

选择子菜单:

Submenu selected

选择并在此区域中盘旋的子菜单:

Submenu selected and hovered in this area

谢谢你的帮助!

r submenu shinydashboard
1个回答
0
投票

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

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
)

我希望这有帮助。

© www.soinside.com 2019 - 2024. All rights reserved.