Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use localstorage only if switchable #1534

Closed
wants to merge 1 commit into from
Closed

Conversation

supcik
Copy link
Contributor

@supcik supcik commented Jan 26, 2020

Use localstorage if dark variation is allowed by admin and the key exists.

Purpose

If the admin removes the "dark variation", the default is still read from the localstorage and there is no easy way for an end-user to use the mode defined by the theme (As far as I know, the only way is to use the developer options of the browser and delete the key there). Additionally, reading a persistent state makes sense if you can change this state. Otherwise, I think that the default should be used.

Screenshots

Not available.

Documentation

No documentation change.

Use localstorage if dark variation is allowed by admin and the key exists.
@gcushen
Copy link
Collaborator

gcushen commented Jan 30, 2020

Why do you have code checking for a username in local storage?

Also, any PR for this feature should address the other open issues on the day/night feature.

@gcushen gcushen closed this in 5e62b09 Feb 9, 2020
YoungWilliamZ pushed a commit to YoungWilliamZ/hugo-academic that referenced this pull request Jul 29, 2020
…t mode

Fixes:
- There is no easy way for a user to reset their day/night preference back to automatic (currently, they must use their web browser to clear the local storage data for the site)
- When changing the theme variation is disabled by admin (by setting `day_night` to `false` in `params.toml`), the operating system's day/night preference is still applied
- If the admin removes the option to change the theme variation, the preference for a user who already visited the site is still read from the localstorage and applied. For example, this could result in the user seeing a theme variation with poor contrast that was not intended to be shown as the site's theme was optimized for the other variation.

Fix HugoBlox#1385
Fix HugoBlox#1526
Fix HugoBlox#1534
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants