paulmartins / hugo-digital-garden-theme

Hugo Theme for digital gardening projects.
MIT License
84 stars 40 forks source link

Config parameter for dark mode #13

Closed not-napoleon closed 1 year ago

not-napoleon commented 1 year ago

Resolves https://github.com/paulmartins/hugo-digital-garden-theme/issues/11

So as discussed on the issue, I added a parameter to set the initial state for dark or light mode. I did some testing locally with private browser windows to clear the local storage and it seems to work. I also spent a while trying to add some kind of validation to ensure the parameter is set to something sensible, but honestly the Go Templates language defeated me. If you've got some pointers on how to do validation in templates, I'd be happy to take another pass at it. That said, it seems to degrade gracefully (to light mode) if the parameter is set to something bogus.

Thanks again for pointing me in the right direction on the issue.

netlify[bot] commented 1 year ago

Deploy Preview for hugo-digital-garden-demo ready!

Name Link
Latest commit c245bf44c4a4adf26e7b844a4cad0315795bf4a1
Latest deploy log https://app.netlify.com/sites/hugo-digital-garden-demo/deploys/642cd3f855bd7f00080859f1
Deploy Preview https://deploy-preview-13--hugo-digital-garden-demo.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.