RinteRface / bs4Dash

Bootstrap 4 shinydashboard using AdminLTE3
https://bs4dash.rinterface.com
Other
440 stars 81 forks source link

Variable for background color of navbar #168

Open DavidBarke opened 3 years ago

DavidBarke commented 3 years ago

I couldn't find any variable in bs4dash_vars for setting the background color of the navbar. I'd have expected something like navbar-light-bg and navbar-dark-bg.

Currently the status of the navbar is removed when switching between light and dark mode.

DivadNojnarg commented 3 years ago

Maybe you can have a look at {fresh} by @pvictor

DavidBarke commented 3 years ago

Thanks for pointing me to this resource. If I take the example from {fresh}, I get a white navbar in light mode (and not dark as displayed in the screenshots).

App ```r library(shiny) library(bs4Dash) library(fresh) theme <- create_theme( bs4dash_vars( navbar_light_color = "#bec5cb", navbar_light_active_color = "#FFF", navbar_light_hover_color = "#FFF" ), bs4dash_yiq( contrasted_threshold = 10, text_dark = "#FFF", text_light = "#272c30" ), bs4dash_layout( main_bg = "#353c42" ), bs4dash_sidebar_light( bg = "#272c30", color = "#bec5cb", hover_color = "#FFF", submenu_bg = "#272c30", submenu_color = "#FFF", submenu_hover_color = "#FFF" ), bs4dash_status( primary = "#5E81AC", danger = "#BF616A", light = "#272c30" ), bs4dash_color( gray_900 = "#FFF" ) ) shinyApp( ui = dashboardPage( freshTheme = theme, header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody() ), server = function(input, output) { } ) ```

In the help page for bs4DashPage() the same theme is used except for the addition of setting white = #272c30 (dark). This colors the navbar background but also colors everything else that relies on $white, e.g. card-bg.

App ```r library(shiny) library(bs4Dash) library(fresh) theme <- create_theme( bs4dash_vars( navbar_light_color = "#bec5cb", navbar_light_active_color = "#FFF", navbar_light_hover_color = "#FFF" ), bs4dash_yiq( contrasted_threshold = 10, text_dark = "#FFF", text_light = "#272c30" ), bs4dash_layout( main_bg = "#353c42" ), bs4dash_sidebar_light( bg = "#272c30", color = "#bec5cb", hover_color = "#FFF", submenu_bg = "#272c30", submenu_color = "#FFF", submenu_hover_color = "#FFF" ), bs4dash_status( primary = "#5E81AC", danger = "#BF616A", light = "#272c30" ), bs4dash_color( gray_900 = "#FFF", white = "#272c30" ) ) shinyApp( ui = dashboardPage( freshTheme = theme, header = dashboardHeader(), sidebar = dashboardSidebar(), body = dashboardBody() ), server = function(input, output) { } ) ```

What does the light variable do? It seems to have no effect.

However, I'll probably write my own rule as this seems to be easier as overriding all variables that use $white.

DivadNojnarg commented 3 years ago

I just remember that fresh doesn’t have the same version as bs4Dash for AdminLTE, which impacts the Result.

pvictor commented 3 years ago

I'll look into it !

pvictor commented 3 years ago

I've updated AdminLTE to 3.1.0 in fresh.