Coder Social home page Coder Social logo

anandchowdhary / light-level Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 802 KB

💡Get a user's light level using CSS @​media(light-level)

Home Page: https://anandchowdhary.github.io/light-level/

License: MIT License

HTML 31.40% TypeScript 68.60%
css light-level typescript media-queries

light-level's Introduction

💡 Light level

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

NPM

Light level is a package that tells you a user's preferred light level. It's based on the CSS @media (light-level), 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 light-level-css

Import the package:

import lightLevel from "light-level-css";

Then call the function:

const lightPreference = lightLevel();
// Returns "dim", "washed" or "normal"

💡 Browser support

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

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

const lightPreference = lightLevel(false);
// Returns "dim", "washed", "normal", or "unsupported"

🛠️ Development

Install dependencies:

yarn

Compile Typescript to ES6 before publishing to NPM:

yarn build

📀 Media Queries Level 5

📝 License

MIT

light-level's People

Contributors

anandchowdhary avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.