gokarna-theme / gokarna-hugo

A minimal opinionated theme for Hugo
https://gokarna-hugo.netlify.app
GNU General Public License v3.0
357 stars 139 forks source link

Keep using auto theme when unset explicitly #220

Closed lzap closed 5 months ago

lzap commented 5 months ago

Hello there!

When the theme loads, it always sets either dark or light mode depending on the OS setting and immediately stores it in local storage. Meaning, if a user initially visits a site in the night, it will be dark forever or until changed by clicking on the icon. And vice versa.

This is a confusing behavior, this patch changes the logic - until the icon is clicked and setting explicitly set by a user, it follows the OS. The change is simple - local storage is not written on page request.

To test this feature:

netlify[bot] commented 5 months ago

Deploy Preview for gokarna-hugo ready!

Name Link
Latest commit 4e63a7b33239be1571f5e51586a4c946c22edeac
Latest deploy log https://app.netlify.com/sites/gokarna-hugo/deploys/662f2e68f6478a0008fafcc8
Deploy Preview https://deploy-preview-220--gokarna-hugo.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.

yashmehrotra commented 5 months ago

LGTM, @526avijitgupta Can you have a look and merge this ?