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

Some bs_theme arguments are seemingly ignored by page_sidebar #1123

Open
lukebandy opened this issue Oct 17, 2024 · 2 comments
Open

Some bs_theme arguments are seemingly ignored by page_sidebar #1123

lukebandy opened this issue Oct 17, 2024 · 2 comments

Comments

@lukebandy
Copy link

Describe the problem

To be honest this is a null issue as it's fine to just use page_navbar(), but did lose me some time to work around.

Doesn't work:

library(bslib)
ui <- page_sidebar(
    title = "Cool app",
    theme = bs_theme(
        preset = "flatly",
        primary = "#95a5a6",
        success = "#3F2A56"
    ),
    sidebar = sidebar()
)
server <- function(input, output) {}
shinyApp(ui, server)

But page_navbar() works:

library(bslib)
ui <- page_navbar(
    title = "Cool app",
    theme = bs_theme(
        preset = "flatly",
        primary = "#95a5a6",
        success = "#3F2A56"
    ),
    sidebar = sidebar()
)
server <- function(input, output) {}
shinyApp(ui, server)

And other arguments (from the documentation) work with page_sidebar:

library(bslib)
ui <- page_sidebar(
    title = "Cool app",
    theme = bs_theme(
        bootswatch = "darkly",
        base_font = font_google("Inter"),
        navbar_bg = "#25443B"
    ),
    sidebar = sidebar()
)
server <- function(input, output) {}
shinyApp(ui, server)

Session Info

R version 4.4.1
bslib: 0.8.0

@gadenbuie
Copy link
Member

Thanks for the report @lukebandy. I think I see what you mean be "works" and "doesn't work": in page_navbar(), changing the primary color changes the navbar background color; page_sidebar() on the other hand doesn't use primary and instead follows $navbar-bg.

page_sidebar() page_navbar()
image image

There's a group of issues around this behavior:

In this case, setting page_navbar(inverse = FALSE) in the second example gives the same results as with page_sidebar(), which doesn't have an inverse argument.

@see24
Copy link

see24 commented Oct 31, 2024

I found a work around to manually set the page_sidebar header background"

theme = bs_theme(bootswatch = "litera") %>%
      bs_add_rules(
        list(
          "body { --bslib-page-sidebar-title-bg: #3f5a36; }"
        )
      )

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

No branches or pull requests

3 participants