Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(preset): Follow $bslib-sidebar-bg when in dashboard mode #1133

Merged
merged 5 commits into from
Nov 21, 2024

Conversation

gadenbuie
Copy link
Member

Fixes #1126
Also allows $bslib-sidebar-bg to set $bslib-sidebar-fg with contrasting color if set by the user.

For testing: comment out the bslib-sidebar-bg lines to switch between setting background color values, same for fg colors, toggle preset = "default" to switch betwen presets.

library(shiny)
pkgload::load_all()

ui <- page_navbar(
  title = "My Simple App",
  theme = bs_theme(
    # preset = "default",
    "bslib-sidebar-bg" = "#732400",
    "bslib-sidebar-bg" = "#fcbb9c",
    # "bslib-sidebar-fg" = "#732400",
    # "bslib-sidebar-fg" = "#fcbb9c",
    cache_buster = format(as.integer(Sys.time()))
  ),
  sidebar = sidebar(
    title = "Settings",
    "Just stuff here"
  ),
  nav_panel("Home",
    h1("Welcome to the Home Page"),
    p("This is some boilerplate text for the home page."),
    card(
      card_header("Just a regular card"),
      layout_sidebar(
        sidebar = sidebar(
          "Some stuff here too",
          position = "right"
        ),
        "And card content with a sidebar!"
      )
    )
  )
)

server <- function(input, output, session) {

}

shinyApp(ui, server)

Fixes #1126
Also allows `$bslib-sidebar-bg` to set `$bslib-sidebar-fg` with contrasting color if set by the user.
@gadenbuie gadenbuie force-pushed the fix/1126-unmask-bslib-sidebar-bg branch from c72f1f4 to f4938f8 Compare November 19, 2024 20:42
@gadenbuie gadenbuie merged commit a0cf60b into main Nov 21, 2024
1 check passed
@gadenbuie gadenbuie deleted the fix/1126-unmask-bslib-sidebar-bg branch November 21, 2024 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shiny preset masks $bslib-sidebar-bg with a custom property in dashboard mode
2 participants