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

ui.page_navbar() doesn't use the expected theme colors #894

Closed
gadenbuie opened this issue Dec 12, 2023 · 0 comments · Fixed by #1124
Closed

ui.page_navbar() doesn't use the expected theme colors #894

gadenbuie opened this issue Dec 12, 2023 · 0 comments · Fixed by #1124

Comments

@gadenbuie
Copy link
Collaborator

Possibly related to #882, but more broadly for other themes, including shinyswatch themes. (shinylive example).

from shiny import App, Inputs, Outputs, Session, render, ui
import shinyswatch

app_ui = ui.page_navbar(
    shinyswatch.theme.flatly(),
    ui.nav_spacer(),
    ui.nav("Page 1", "Page 1 content."),
    ui.nav("Page 2", "Page 2 content."),
    ui.nav("Page 3", "Page 3 content."),
    title="Dashboard",
)


def server(input, output, session):
    pass


app = App(app_ui, server)

image

In R, using the Flatly Bootswatch theme, the navbar is green by default. This may not be the right choice either, but it points to different assumptions that may not be met in py-shiny.

image

R Code [Open on shinylive](https://shinylive.io/r/editor/#code=NobwRAdghgtgpmAXGKAHVA6ASmANGAYwHsIAXOMpMAGwEsAjAJykYE8AKAZwAtaJWAlAB0IdJiw71OY4RBEBXWgAIAPAFolqKAHM4AfWgA3ei3YilS0rVLU4SgLxKhYACJQe9IiwAmz3OctuOHgHJSk9UiD4dlRGOE44UlDnADNqKBtWZwF-CAsjPU4tAjhGdhyAgq0IOGozMAAFKBrqJQBGPycwABVeTiVafura9uzc-KhDPWG65yaWpQAmTudewYGh5pHlsAq8pSqt2cajpQBmFZ6+jc1Ti92RWREExkNS1Q0U+QgCKxJ2PioeSkXBKIjAoEgpQJTicWgkARKEAiEQAXxREB4fFYAEF0OxFKCXm9GAIwKiALpAA)
library(shiny)
library(bslib)

ui <- page_navbar(
  title = "Dashboard",
  theme = bs_theme(preset = "flatly"),
  nav_spacer(),
  nav_panel("Panel 1", "This is panel 1"),
  nav_panel("Panel 2", "This is panel 2"),
  nav_panel("Panel 3", "This is panel 3")
)

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

}

shinyApp(ui, server)

This issue was inspired by https://discord.com/channels/1109483223987277844/1183883532855148584

cpsievert added a commit that referenced this issue Feb 13, 2024
…vbar-inverse support to resolve several issues with navbar theming
cpsievert added a commit that referenced this issue Feb 13, 2024
…vbar-inverse support to resolve several issues with navbar theming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant