Detects the user’s preferences for inverted colors using the
inverted-colors
CSS3 level 5 media query.
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 minified, or 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…