JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 24
  • Score
    100M100P100Q45638F
  • License MIT

Calculate data about any display (width, height, ratio, area, density, etc.)

Package Exports

  • screencalc

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (screencalc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ScreenCalc

ScreenCalc allows data about any display to be easily calculated. For example, from resolution and diagonal size the physical width and height, pixel density, aspect ratio, area, and other properties can be retrieved.

Usage

Install using npm.

npm install screencalc

For client-side usage, check out browserify.

var ScreenCalc = require('screencalc');
var screen = new ScreenCalc(1920, 1080, 10.6);

var strRatio      = screen.getStringRatio();   // "16:9"
var pixelDensity  = screen.getPixelDensity();  // 208
var physicalWidth = screen.getPhysicalWidth(); // 9.2387
var area          = screen.getArea();          // 48.01
var pixelCount    = screen.getPixelCount();    // 2073600

Development

ScreenCalc is written in TypeScript. After editing files, run grunt to compile everything, then npm test to ensure all the tests pass. Use test/browser/index.html to run the tests in a browser.

License

MIT