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

Consider documenting pkgdown-navbar-bg and pkgdown-navbar-bg-dark as needed to set navbar color with a bootswatch theme with light-switch enabled #2703

Open
remlapmot opened this issue Jul 8, 2024 · 1 comment

Comments

@remlapmot
Copy link

I contribute to a site on which we've traditionally used the United theme https://bootswatch.com/united/. That theme uses a navbar in Ubuntu orange.

bootswatch-united

In pkgdown 2.1.0 if I don't specify the light-switch the navbar is the expected colour (as it is when using previous versions of pkgdown).

But if I enable the light-switch the navbar is set to a much lighter colour than that defined in the theme.

navbar-2-1-0-with-light-switch

Looking at the code

$pkgdown-navbar-bg: null !default;
$pkgdown-navbar-bg-dark: null !default;
// BS navbars appears to be designed with the idea that you have a coloured
// navbar that looks the same in both light and dark mode. We prefer a mildly
// coloured navbar that's just different enough from the body to stand out.
//
// Relies on CSS fallback rules
.navbar {
background: RGBA(var(--bs-body-color-rgb), 0.1);
background: color-mix(in oklab, color-mix(in oklab, var(--bs-body-bg) 95%, var(--bs-primary)) 95%, var(--bs-body-color));
background: $pkgdown-navbar-bg;
// Harmonize alignment of navbar elements (search field vs. rest)
line-height: initial;
}
[data-bs-theme="dark"] .navbar {
background: $pkgdown-navbar-bg-dark;
}

I think you've kindly left an override in, pkgdown-navbar-bg (and pkgdown-navbar-bg-dark), which I used to specify the expected navbar colour under the bslib menu, but these don't seem to be documented.

template:
  bootstrap: 5
  light-switch: true
  bslib:
    bootswatch: united
    pkgdown-navbar-bg: '#e95420'

With this specified I get the expected navbar color.

navbar-2-1-0-with-override

These two variables are certainly helpful to me and would seem worth a mention in the customise.Rmd vignette.

@certara-mtalley
Copy link

Encountered the same issue with the same color. This tip was greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants