helt / pixel-units

Type-safe and mutually convertible pixel units.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pixel-units

Github Twitter

πŸ”§ Features

Absolute length units

  • px
  • cm
  • mm
  • Q
  • in
  • pc
  • pt

Relative length units

  • rem
  • em
  • vw
  • vh
  • vmin
  • vmax

Multiplication units

  • percent
  • magnification

πŸ‘ Getting Started

The basic usage is as follows:

import { Unit, convertUnits } from '@karibash/pixel-units';

const pixel: Unit<'px'> = '32px';
const rem = convertUnits(pixel, 'rem');

console.log(rem);
// -> 2rem

πŸš€ Installation

$ npm install @karibash/pixel-units

🀝 Contributing

Contributions, issues and feature requests are welcome.

Feel free to check issues page if you want to contribute.

πŸ“ License

Copyright Β© 2020 @Karibash.

This project is MIT licensed.

About

Type-safe and mutually convertible pixel units.

License:MIT License


Languages

Language:TypeScript 95.4%Language:JavaScript 4.6%