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 dark mode detection when using auto-switching for dark mode #20

Merged

Conversation

anderscarling
Copy link
Contributor

No description provided.

Sources/DarkMode.swift Outdated Show resolved Hide resolved
@sindresorhus sindresorhus changed the title Implement isEnabled using NSApperance.current on macOS >= 10.14 in order to give correct status when using autoswitching Fix dark mode detection when using auto-switching for dark mode Mar 5, 2021
@anderscarling
Copy link
Contributor Author

Weirdly, my old code worked just as well as using the bestMatch api to check for appearance, even though I enabled "increased contrast" and maxed out the contrast slider in accessibility settings.

Screenshot 2021-03-05 at 11 21 54 AM

Tried a bit of googling but could not find any information about how to trigger .accessibilityHighContrastDarkAqua so I was not able to find a configuration where the old code broke.

However, I agree using bestMatch is definitely the way to go and seems to work in all scenarios I was able to reproduce.

@sindresorhus
Copy link
Owner

Tried a bit of googling but could not find any information about how to trigger .accessibilityHighContrastDarkAqua so I was not able to find a configuration where the old code broke.

I don't know either, but Apple explicitly said in a WWDC video at the time that bestMatch was the correct way to detect.

@sindresorhus sindresorhus merged commit f717531 into sindresorhus:main Mar 6, 2021
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