leanprover / doc-gen4

Document Generator for Lean 4
Apache License 2.0
65 stars 41 forks source link

add dark mode #132

Closed 4e554c4c closed 1 year ago

4e554c4c commented 1 year ago

This commit adds a dark mode to doc-gen4. It takes much inspiration from leanprover-community/doc-gen#160. Unlike the dark theme in doc-gen, this will work with or without javascript. If javascript is disabled, the color picker will not work. However, the correct theme will be detected from the browser based on css media queries. If javascript is enabled, the color picker will work and color picker preferences will be remembered.

note: a dark-mode is not added to inked code. This PR only applies to generated documentation.

closes #117

4e554c4c commented 1 year ago

there seems to be an issue switching from a defined colorscheme to system colorscheme (e.g. "dark theme" -> "system") then the theme does not update until you refresh. not sure why this is happening, since it doesn't happen with doc-gen.

4e554c4c commented 1 year ago

ok i think i took care of all of the edge cases.

hargoniX commented 1 year ago

Thank's a lot, it seems to work for me too. Unfortunately the matlhib doc builds right now are broken due to some weird meta programming issue so this won't be deployed too son.