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

Default dark mode #241

Closed
dystechnic opened this issue Jan 12, 2024 · 4 comments
Closed

Default dark mode #241

dystechnic opened this issue Jan 12, 2024 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@dystechnic
Copy link

Is your feature request related to a problem? Please describe.
Whenever the browser is reloaded (closed and opened again) the skin defaults back to light mode. Probably because cookies are removed?

Describe the solution you'd like
Is it possible to make dark-mode the default so whenever someone opens the site it will be dark until they select light on purpose?

Describe alternatives you've considered
None

@dystechnic dystechnic added the enhancement New feature or request label Jan 12, 2024
@Daveiano Daveiano added bug Something isn't working and removed enhancement New feature or request labels Jan 18, 2024
@Daveiano
Copy link
Owner

It shouldn't be like that!

The skin should "remember" the current theme (light/dark) even if you close the browser and re-open it. The setting gets saved via localStorage (see https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) in the browser.

Could you please test this with my private page?

Go to https://www.weewx-hbt.de/, and activate dark mode. Then close the tab or the whole browser and visit the page again, it should still be in dark mode.

If it shows up in light theme, something with you browser seems to be fishy, perhaps only private browsing allowed?

@dystechnic
Copy link
Author

I tried it with https://www.weewx-hbt.de/ and the result is the same.
Darkmode settings seem to be stored locally. Because we are using the system in a semi-public area we remove all history, cookies, etc every time the browser closes. And it seems that with that the darkmode prefference is deleted also.

@Daveiano Daveiano added this to the 3.5.0 milestone Feb 2, 2024
@Daveiano Daveiano added documentation Improvements or additions to documentation enhancement New feature or request and removed bug Something isn't working labels Feb 3, 2024
@Daveiano
Copy link
Owner

Daveiano commented Feb 3, 2024

@dystechnic I added a new configuration, from the (not yet published) wiki:

default_theme One of 'light', 'dark' or 'auto'. If set to 'auto', the skin will use the OS/browser's setting. If the browser is set to dark mode, the skin will use the dark theme, otherwise the light theme. If you want to force the dark mode, set default_theme to 'dark'.

I released a pre-release to test this out: https://github.com/Daveiano/weewx-wdc/releases/tag/v3.5.0-alpha2

@dystechnic
Copy link
Author

I tried it and it works as expected.
Great job! Thank you. I'll wait for the official release.

@Daveiano Daveiano closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants