我怎样才能简单地添加一个 css 文件来更改我闪亮的应用程序的背景颜色

How can I simply add a css file to change the background color for my shiny app

我正在重新提问...

...为尚未真正获得 css 的用户推广它。我已经花时间阅读 http://shiny.rstudio.com/articles/css.html 上的 rstudio css 指南,但它仍然没有点击。我了解一些事情,但我认为这意味着我已经完成了 90%。

  1. css 文件必须在 ui.r 中链接,并从 fluidPage 或 navbarPage 函数中的主题参数链接。
  2. 添加一个非常稀疏的 css 文件来添加背景颜色会破坏现有的 css。

所以,我的问题是 css 的最简单实现是什么,用于更改 http://shiny.rstudio.com/gallery/faithful.html 闪亮图库中示例直方图应用程序的背景颜色。

我认为这个问题的答案会对像我这样 css 的新手应用开发者有所帮助。

摘自Shiny文章:

Once your Shiny app directory is set, you have two choices to link to your CSS file (your app won’t use the CSS until you do). You can:

  • set the theme argument of fluidPage to your document’s name
  • or include the file with the tags object.

但最简单的方法似乎真的是使用函数 includeCSS():

includeCSS(path, ...)

或者只在 example 中添加一个内联样式:

plotOutput(outputId = "main_plot", height = "300px" style="background-color:pink;"),