r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
718 stars 336 forks source link

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 4 months ago

remlapmot commented 4 months ago

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

https://github.com/r-lib/pkgdown/blob/f20a64976d359c3f763c34f92cae9c0bc87ba5be/inst/BS5/assets/pkgdown.scss#L23-L40

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 commented 1 month ago

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