1.1.0 • Published 5 years ago
pixel-density v1.1.0
pixel-density
Calculates how many pixels per inch a screen has
Installation
Node.js environment
npm i pixel-density --save
Browser environment
Include this line in your HTML (preferably in the body; here's why) and you can obtain pixel-density via the jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/pixel-density@1"></script>
or the unpkg CDN:
<script src="https://unpkg.com/pixel-density@1"></script>
or you can download the latest version of pixel-density here.
Usage
Node.js environment
const pixelDensity = require('pixel-density');
Node.js environment + Browser environment
pixelDensity(1920, 1080, 24);
//=> 91.7877987534291
pixelDensity(2560, 1440, 5.5);
//=> 534.038101838133
Changelog
You can read the changelog here.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
See also the list of contributors who participated in this project.
License
This project is licensed under the GPL-3.0 License - see here for more details.