@karibash/pixel-units
v2.3.0
Published
Type-safe and mutually convertible pixel units.
Downloads
54,616
Readme
pixel-units
🔧 Features
Absolute length units
- [x] px
- [x] cm
- [x] mm
- [x] Q
- [x] in
- [x] pc
- [x] pt
Relative length units
- [x] rem
- [x] em
- [x] vw
- [x] vh
- [x] vmin
- [x] vmax
Multiplication units
- [x] percent
- [x] 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.