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

feat: detect user's dark mode preferences automagically #18

Merged
merged 1 commit into from
Jun 22, 2024

Conversation

jamietanna
Copy link
Contributor

As noted in #15, it would be handy to respect the user's preferred
light/dark mode settings, if we can detect it.

This only gets referenced if there isn't an explicitly set mode in their
localStorage.

This also extracts this logic to a function, so we can more easily write
a multi-line conditional, but retains the ternary logic to follow the
project's style preferences.

Closes #15.


I've tested this locally with a browser that has dark mode preference, and one that doesn't, and it works 👏

As noted in frectonz#15, it would be handy to respect the user's preferred
light/dark mode settings, if we can detect it.

This only gets referenced if there isn't an explicitly set mode in their
`localStorage`.

This also extracts this logic to a function, so we can more easily write
a multi-line conditional, but retains the ternary logic to follow the
project's style preferences.

Closes frectonz#15.
@frectonz frectonz merged commit bb6ed24 into frectonz:main Jun 22, 2024
6 checks passed
@frectonz
Copy link
Owner

Thank you very much 🙏

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.

Honour the user's dark scheme preferences
2 participants