'R bs4dash fresh package doesn't work properly
According to the documentation in https://cran.r-project.org/web/packages/fresh/vignettes/vars-bs4dash.html
bs4dash_status(light = "red") should render a red background in the navbar. However, it doesn't. It still remains white. Any thoughts as to why?
I can put bs4dash_color(white = "red") and that will change the navbar background, but it changes other things as well, which I don't really want.
library(shiny)
library(bs4Dash)
library(fresh)
theme1 = create_theme(
bs4dash_sidebar_light(bg = "green"),
bs4dash_layout(),
bs4dash_status(primary = "#5E81AC", danger = "#BF616A", light = "red"),
bs4dash_layout(main_bg = "#353c42"),
bs4dash_color(gray_900 = "#FFF"), # white = "#272c30" changes the border and sidebar and footer
bs4dash_status(light = "red"),
bs4dash_vars(main_footer_bg = "purple",
navbar_light_color = "#bec5cb",
navbar_light_active_color = "#FFF",
navbar_light_hover_color = "#FFF")
)
ui = dashboardPage(
header = dashboardHeader(),
sidebar = dashboardSidebar(skin = "light"),
controlbar = dashboardControlbar(),
footer = dashboardFooter(),
body = dashboardBody(use_theme(theme1))
)
server = function(input, output){}
shinyApp(ui,server)
Solution 1:[1]
I know this question is a bit old but I came across it trying to fix the same problem. I found that if you create the css file using the fresh package like such:
create_theme(
bs4dash_sidebar_light(bg = "green"),
bs4dash_layout(),
bs4dash_status(primary = "#5E81AC", danger = "#BF616A", light = "red"),
bs4dash_layout(main_bg = "#353c42"),
bs4dash_color(gray_900 = "#FFF"), # white = "#272c30" changes the border and sidebar and footer
bs4dash_status(light = "red"),
bs4dash_vars(main_footer_bg = "purple",
navbar_light_color = "#bec5cb",
navbar_light_active_color = "#FFF",
navbar_light_hover_color = "#FFF"),
output_file = "www/myCustomFresh.css"
)
you can then go into the file and change the value yourself. Open in a text editor and find ".navbar-white" and change the background-color to red: ".navbar-white{background-color:red}". Then in your UI you have :
body = dashboardBody(use_theme("myCustomFresh.css"))
Hope this helps others that were stuck like me.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Justin Womack |
