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

matchMedia? #1

Open
bathos opened this issue Aug 27, 2019 · 1 comment
Open

matchMedia? #1

bathos opened this issue Aug 27, 2019 · 1 comment

Comments

@bathos
Copy link

bathos commented Aug 27, 2019

I know prefers-contrast isn’t yet supported anywhere so this is moot right now, but matchMedia is well-supported and will be available in any browser that does introduce support for prefers-contrast. Any reason not to use it to perform the test directly?

Might look something like:

const prefs = [ 'high', 'low', 'no-preference' ];

export default (fallback='no-preference') =>
  prefs.find(pref => matchMedia(`(prefers-contrast: ${ pref })`).matches) ||
  fallback;
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.64. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant