Skip to content

dark-mode: allow following the system preference again #1994

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

Merged
merged 1 commit into from
Apr 15, 2025

Conversation

dscho
Copy link
Member

@dscho dscho commented Apr 14, 2025

Changes

  • With this PR, the user preference regarding dark mode will only be stored when it differs from the system, otherwise no user preference will be stored (because it is not necessary, and it accommodates for situations where the user toggles the system preference back and forth).

Context

After toggling dark mode on and off again, a subsequent change of the system preference to dark mode will currently not be respected because the manual toggling stored the user's preference as "light mode", no matter what the system preference is.

Let's store the user preference only when it differs from the system preference. That way, in the scenario above the system preference would be followed again.

/cc @To1ne

After toggling dark mode on and off again, a subsequent change of the
system preference to dark mode will not respected because the toggling
stored the user's preference.

Let's store the user preference only when it differs from the user's
choice. That way, in the scenario above the system preference would be
followed again.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho self-assigned this Apr 14, 2025
@dscho
Copy link
Member Author

dscho commented Apr 14, 2025

As usual, my PR can be seen in action at https://dscho.github.io/git-scm.com/ (inspect localStorage.getItem('theme') via DevTools).

@To1ne
Copy link
Collaborator

To1ne commented Apr 15, 2025

Good enough for me.

/approve

@dscho dscho merged commit 8fb5738 into git:gh-pages Apr 15, 2025
1 check passed
@dscho dscho deleted the reset-dark-mode-preference-when-possible branch April 15, 2025 08:29
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.

2 participants