Miss any of our Open RFC calls?Watch the recordings here! »

pixel-density

1.1.0 • Public • Published

pixel-density

Calculates how many pixels per inch a screen has

Build Status npm bundle size (minified + gzip) npm GitHub issues GitHub closed issues GitHub

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.

Install

npm i pixel-density

DownloadsWeekly Downloads

6

Version

1.1.0

License

GPL-3.0

Unpacked Size

48 kB

Total Files

11

Last publish

Collaborators

  • avatar