【问题标题】:How to change the color of Pined controlbar in Shiny Dashboard如何更改 Shiny Dashboard 中固定控制栏的颜色
【发布时间】:2022-01-17 12:00:12
【问题描述】:

正在寻找一种方法来更改 shinyDashboard 中固定控制栏的颜色。当您将控制栏固定在主页右侧时,我已经能够更改闪亮仪表板中每个元素的颜色,除了小针。 任何帮助将不胜感激。

library(shiny)
library(bs4Dash)

shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
    controlbar = dashboardControlbar(
      id = "controlbar",
      collapsed = FALSE,
      overlay = TRUE, 
      skin = "light",
      pinned = T
    )
  ),
  server = function(input, output, session) {
  }
)

【问题讨论】:

  • 你需要改变图标的​​颜色
  • 谢谢@Aman Sharma,你能把它添加到我在这篇文章中包含的简单代码块吗?

标签: css r shiny styles shinydashboard


【解决方案1】:

要更改图钉颜色,您可以使用

tags$head(tags$style(type = "text/css", ".fa-thumbtack {color:rgb(255,0,0)  !important;}"))

完整代码

library(shiny)
library(bs4Dash)

shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(),
    sidebar = dashboardSidebar(),
    body = dashboardBody(
      #tags$style(".fa-thumbtack {color:rgb(255,0,0)}"), ##  this changes only the horizontal pin color
      tags$head(tags$style(type = "text/css", ".fa-thumbtack {color:rgb(255,0,0)  !important;}"))
    ),
    controlbar = dashboardControlbar(
      id = "controlbar",
      collapsed = FALSE,
      overlay = TRUE, 
      skin = "light",
      pinned = T
    )
  ),
  server = function(input, output, session) {
  }
)

【讨论】:

  • 谢谢,@YBS,您的解决方案解决了我的问题。碰巧,您知道如何仅更改垂直引脚的颜色吗?
  • 没有。您应该使用 CSS 来尝试找出答案。
猜你喜欢
  • 1970-01-01
  • 2019-02-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-07-18
  • 2021-01-13
  • 2012-09-11
相关资源
最近更新 更多