Skip to content

🌑 Detects the user’s preferences for inverted colors using the 'inverted-colors' CSS3 level 5 media query.

License

Notifications You must be signed in to change notification settings

magica11y/inverted-colors

Repository files navigation

invertedColors()

Detects the user’s preferences for inverted colors using the inverted-colors CSS3 level 5 media query.

Travis NPM Bundlephobia Bundlephobia Coveralls David DM David DM NodeJS License Snyk

Magica11y cover

✨ Introduction

Quoting from the CSS3 level 5 media queries specfication…

The 'inverted-colors' media feature indicates whether the content is displayed normally, or whether colors have been inverted.

🌑 invertedColors() is part of 🔮 Magica11y, which provides a suite of functions to detect “user-preference” and “environment” media features.

Magica11y functions are awesome because…

  • They have zero dependencies
  • They’re lightweight; e.g. invertedColors() is just Bundlephobia minified, or Bundlephobia minified & gzipp’d
  • They use the window.matchMedia API underneath
  • They’re optimized for performance; all the module functions are designed in such a way that they exit early
  • They provide a clean, well-documented and semantic API to work with

In addition to invertedColors(), Magica11y also provides…