changing the font color of the sidebar in shiny dashboard

I have literally no html/css experience and hence I solicit your help with the following.

I am using a shiny dashboard with a default sidebar. I tried to change the background color and the font color of the sidebar using the following line of code inside the dashboardBody:

tags$head(tags$style(HTML('.skin-black .main-sidebar {color: #000000; background-color: #FFB6C1;}')))

What happened was that the new sidebar has a background color of #FFB6C1, which I intended to. But the font color in the sidebar didn't change into black and it is still white! Any suggestion?

Thanks a lot San


I came across an example that helped me solving the issue. http://journocode.com/2016/04/04/r-first-web-application-shiny/

Accordingly, the problem was solved by used:

label = HTML('<p style="color:black;">Maximum number of suggestions</p>')

in order to depict the color of the label in black instead of white color obtained when using only:

label = "Maximum number of suggestions"

Of course both were arguments of the selectInput object.

Thanks KH for the help and of course thanks MARIE-LOUISE TIMCKE for your amazing post.

Ciao


Your CSS selector may not be targeting text elements, rather a sidebar div. Assuming your text elements are under the .main-sidebar class, this should/may work. Just replace ELEMENT with whatever HTML tag your text is enclused in, like

.skin-black .main-sidebar ELEMENT {
color: #000000;

.skin-black .main-sidebar {
background-color: #FFB6C1;
}

Whitespace does not matter.

链接地址: http://www.djcxy.com/p/89144.html

上一篇: 将ui.R的闪亮变量传递给server.R

下一篇: 在闪亮的仪表板中更改边栏的字体颜色