RMI-PACTA / pacta.pkgdown.rmitemplate

https://rmi-pacta.github.io/pacta.pkgdown.rmitemplate/
Other
2 stars 0 forks source link

add light, dark, and auto modes to pkgdown template #40

Closed cjyetman closed 1 month ago

cjyetman commented 1 month ago

https://pkgdown.r-lib.org/articles/customise.html?q=dark#light-switch

jdhoffa commented 1 month ago

Aren't we using custom RMI colours/css for thispkgdown template? Do we need to consider that at all here? It's not clear to me what the alternative colour scheme would default to here.

cjyetman commented 1 month ago

Aren't we using custom RMI colours/css for thispkgdown template? Do we need to consider that at all here? It's not clear to me what the alternative colour scheme would default to here.

to be honest, I'm not sure... and I'm not sure how to test this really. But, my understanding is that it uses fancy CSS to determine appropriate colors to reduce the brightness

jdhoffa commented 1 month ago

Aren't we using custom RMI colours/css for thispkgdown template? Do we need to consider that at all here? It's not clear to me what the alternative colour scheme would default to here.

to be honest, I'm not sure... and I'm not sure how to test this really. But, my understanding is that it uses fancy CSS to determine appropriate colors to reduce the brightness

Hmm, in my experience with other frameworks, the dark and light templates need to be specified explicitly.

I think you can build the pkgdown website locally to test it? I guess it might be tricky since the pkgdown.yml would need to point to this PR somehow.

cjyetman commented 1 month ago

converted to draft... not super critical to me, just wanted to drop a PR before I forgot about it. Maybe look into testing it out first some time soon

jdhoffa commented 1 month ago

Yeah just confirmed my suspicion here: https://getbootstrap.com/docs/5.3/customize/color-modes/#how-it-works

In particular:

For each color mode you wish to support, you’ll need to add new overrides for the shared global CSS variables. We do this already in our _root.scss stylesheet for dark mode, with light mode being the default values.

Since we are using custom css here: https://github.com/RMI-PACTA/pacta.pkgdown.rmitemplate/blob/main/inst/pkgdown/extra.scss , I am not convinced this would just "work" out of the box, without us manually specifying what the light/ dark mode overrides should be.

I don't know if this is worth the effort right now? If you want to explore it then feel free, otherwise I would convert this PR to an issue for further exploration.

jdhoffa commented 1 month ago

Also note (from https://pkgdown.r-lib.org/articles/customise.html?q=dark#light-switch):

(Themes are unlikely to work with the light switch, but you can try it and see.)

jdhoffa commented 1 month ago

Closing in favour of #41