如何在R中更改闪亮仪表板上的背景色

时间:2021-02-14 19:47:17

I love the new shiny dashboard package in R. I am trying to customize the appearance and its proving difficult. I want to change the background color of the app to white.

我喜欢在r的新的闪亮仪表盘包,我试图自定义外观和它的证明困难。我想把app的背景颜色改成白色。

Here is what I have done.

这是我所做的。

I have added a custom.css file to a www directory. It has this code.

我添加了一个习惯。css文件到一个www目录。这段代码。

body > .content-wrapper .right-side {
    background-color: #ffffff;
}

I have successfully changed the title font with the example here so I know that my css file is working.

我已经通过这里的示例成功地更改了标题字体,因此我知道我的css文件正在工作。

I have also used inspect element to find the color in the css and changed it successfully from the developer console.

我还使用了inspect元素来查找css中的颜色,并在developer console中成功地更改了颜色。

However the background color will not change when I set the color in my css file.

但是当我在css文件中设置颜色时,背景颜色不会改变。

2 个解决方案

#1


12  

Adding this to the custom.css file worked...

添加到自定义中。css文件工作……

I found this in the css file for the adminLTE in the shiny dashboard repo.

我在css文件为adminLTE在闪亮的仪表板repo中发现了这一点。

.content-wrapper,
.right-side {
  background-color: #ffffff;
}

#2


2  

If you only want to change the background, in the ui.R after

如果你只想改变背景,在ui中。R后

shinyUI(fluidPage(

you can add this code:

您可以添加以下代码:

tags$head(tags$style(
    HTML('
        body, label, input, button, select { 
            font-family: "Calibri";
            background-color: black;
        }')
    )),

#1


12  

Adding this to the custom.css file worked...

添加到自定义中。css文件工作……

I found this in the css file for the adminLTE in the shiny dashboard repo.

我在css文件为adminLTE在闪亮的仪表板repo中发现了这一点。

.content-wrapper,
.right-side {
  background-color: #ffffff;
}

#2


2  

If you only want to change the background, in the ui.R after

如果你只想改变背景,在ui中。R后

shinyUI(fluidPage(

you can add this code:

您可以添加以下代码:

tags$head(tags$style(
    HTML('
        body, label, input, button, select { 
            font-family: "Calibri";
            background-color: black;
        }')
    )),