joeroe / risotto

A minimalist, responsive hugo theme inspired by terminal ricing aesthetics.
https://risotto.joeroe.io
MIT License
392 stars 109 forks source link

Theme switching (light/dark) #84

Open joeroe opened 2 months ago

joeroe commented 2 months ago

On a related note, how hard would it be to implement a theme-switching button for this template (aka light/dark mode)?

Originally posted by @BachoSeven in https://github.com/joeroe/risotto/issues/50#issuecomment-2212432484

jrgn9 commented 1 month ago

I looked into how hard it would be to do myself and stumbled upon this: https://yonkov.github.io/post/add-dark-mode-toggle-to-hugo/

I haven't looked too closely on it. But it would be fantastic to be able to just set dark and light palette, and then get a switch for it.

BachoSeven commented 2 weeks ago

On my site, I ended up implementing it as in https://github.com/joeroe/risotto/issues/50#issuecomment-2212448137 but even simpler, still using the media query (without any button):

https://github.com/BachoSeven/bachoseven.github.io/commit/aa597a274f2f6e0aa2ccb234c65e2343c8a11c83#diff-96dd75a968976edd5e03170268ed9085733f75c3fb24f992ae613c89e6de42dc

This uses an additional paletteLight variable in [params.theme] for configuration.