【问题标题】:How to modify the themes of shinythemes?如何修改闪亮主题的主题?
【发布时间】:2019-06-21 12:39:44
【问题描述】:

如何修改shinythemes的主题?例如,假设我想将darkly 的背景更改为黑色。

library(shiny)
library(shinythemes)

ui <- fluidPage(
  theme = shinytheme("darkly"),
  "How to change this black?")

server <- function(input, output) {}

shinyApp(ui, server)

我想一种解决方案是将darkly 的CSS 与修改后的黑色复制到我的应用程序的www 文件夹中,然后使用theme = "darkly_modified_black.css"。我缺少更简单的解决方案吗?

【问题讨论】:

    标签: shiny shinythemes


    【解决方案1】:

    如果您只想更改背景颜色,可以包含自己的 css 参数。 但是是的,你也可以复制darkly的css,修改它,将它包含在www文件夹中,然后从那里加载。

    library(shiny)
    library(shinythemes)
    
    css <- HTML(" body {
        background-color: #000000;
    }")
    
    ui <- fluidPage(
      tags$head(tags$style(css)),
      theme = shinytheme("darkly"),
      "How to change this black?")
    
    server <- function(input, output) {}
    
    shinyApp(ui, server)
    

    如果您想要一个单独的 .css 文件,您可以使用 includeCSS 和文件路径。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-06
      • 1970-01-01
      • 2016-08-24
      • 1970-01-01
      • 2013-04-06
      • 2018-08-03
      相关资源
      最近更新 更多