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

Fixed support for prefers-color-scheme #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JanBobolz
Copy link

Fixed support for browser's prefers-color-scheme (the previous attempts seemed to have no effect).

The precedence of how night mode is enabled/disabled is now as follows:

  • If the user ever clicks a button, a cookie is set and that setting persists for 30 days.
  • If the user never clicks any buttons, night mode is activated if any of the following happens:
    • the browser's prefers-color-scheme is dark.
    • the admin has set night mode as default.

So in particular, if there are no buttons and you don't set night mode as default, then the blog will now properly obey the iOS/macOS dark mode settings (dynamically, i.e. also if the page is already open when the OS switches dark mode on or off).

@John-S4
Copy link

John-S4 commented Apr 10, 2021

Great commit - fixes the issue on Apple devices as stated and also on Windows and Android.

@dansleboby
Copy link

I confirm, using this fix enable the right behaviours, please merge it!

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.

3 participants