Closed not-napoleon closed 1 year ago
The info below should help you with witch the default theme to dark mode.
It is not ideal to modify directly the theme files and a better approach would be to have a parameter to configure it in the .toml
file but I'll need to look at that at a later time. Of course you're welcome to submit a pull request if you feel like you can work it out 🙂
The logic to switch theme is here: static/js/dark.js#L24.
I would suggest replacing light
with dark
on line 24.
The html toggle element is here: layouts/partials/header.html#L22
Note: I used this blog post to implement the dark mode.
Hope it helps, Paul
Cool, thanks, I'll take a look. I agree a parameter to configure it would make the most sense; I'll try to see if I can make that happen and send a PR. I'm still a real newbie at Hugo themes, but hopefully I can figure it out. Thanks for showing me where to start.
Did you managed to get the default dark mode in the end ? If so would you be happy if I closed this ?
I got swamped at my day job and caught covid (I'm mostly recovered), so actually haven't had a chance to look at this since I last replied. That said, if you want to close it that's fine with me. I think I have the information I need to do what I want. I still hope to submit a PR for enabling dark mode by default, as soon as I get some time to work on it.
Sorry to hear that. Good to know you are feeling better. Don't worry there is no rush, I was just doing some repo housekeeping. I can leave that open for now.
Not sure if this is a feature request, or just something I couldn't figure out how to do. I would like to set the theme to automatically open in dark mode, while leaving the toggle available for folks who prefer light mode. Thanks!