1.0.1 • Published 5 years ago

environment-blending v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

🧖 Environment blending

Travis CI Coverage Status GitHub Vulnerabilities NPM type definitions NPM Minzipped size

NPM

Environment blending is a package that tells you a user's environment blending preferences. It's based on the CSS @media (environment-blending), which is part of Media Queries Level 5. It's around 700 bytes minified, 300 bytes gzipped.

⭐ Usage

Add the dependency from NPM:

npm install environment-blending

Import the package:

import envBlending from "environment-blending";

Then call the function:

const contrastPreference = envBlending();
// Returns "additive", "subtractive" or "opaque"

💡 Browser support

This package only works in browsers that natively support @media (environment-blending), so it just returns "opaque" in unsupported browsers. Current browser support

By passing false as the argument, you can get "unsupported" as the value for unsupported browsers:

const contrastPreference = envBlending(false);
// Returns "additive", "subtractive", "opaque", or "unsupported"

🛠️ Development

Install dependencies:

yarn

Compile Typescript to ES6 before publishing to NPM:

yarn build

📀 Media Queries Level 5

📝 License

MIT