minify-hex-code
v1.0.5
Published
Convert 6-character hex codes to 3-characters
Downloads
3
Readme
minify-hex-code
Convert 6-character hex codes to 3-characters
Installation
npm install minify-hex-code
yarn add minify-hex-code
Usage
In a node project
Import the script to your project
import minifyHexCode from 'minify-hex-code';
// or
const minifyHexCode = require('minify-hex-code');
And execute the script:
const shortHexCode = minifyHexCode('#000000'); // #000
const shortHexCode = minifyHexCode('#eeeeee'); // #000
const shortHexCode = minifyHexCode(); // throws error
Contributing
Fork the repo and clone locally, then run:
yarn install
This will install the devDependencies
packages and build the lib
folder.
Once you've made your desired changes, make sure to write any new tests for your feature and run the tests:
yarn run lint # lints js
yarn test # runs test suite
If all tests pass, create a pull request.