https://github.com/nielse63/minify-hex-code
Convert 6-character hex codes to 3-characters
https://github.com/nielse63/minify-hex-code
css hex-color javascript minify node shorten
Last synced: 2 months ago
JSON representation
Convert 6-character hex codes to 3-characters
- Host: GitHub
- URL: https://github.com/nielse63/minify-hex-code
- Owner: nielse63
- License: mit
- Created: 2017-07-07T21:45:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-27T17:40:15.000Z (over 3 years ago)
- Last Synced: 2025-02-15T17:11:15.446Z (3 months ago)
- Topics: css, hex-color, javascript, minify, node, shorten
- Language: JavaScript
- Size: 488 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# minify-hex-code
[](https://travis-ci.org/nielse63/minify-hex-code)
[](https://coveralls.io/github/nielse63/minify-hex-code?branch=master)
[](https://david-dm.org/nielse63/minify-hex-code?type=dev)
[](https://codeclimate.com/github/nielse63/minify-hex-code)
[](http://badge.fury.io/js/minify-hex-code)
[](https://www.npmjs.com/package/minify-hex-code) [](https://greenkeeper.io/)Convert 6-character hex codes to 3-characters
## Installation
```bash
npm install minify-hex-code
yarn add minify-hex-code
```## Usage
### In a node project
Import the script to your project
```js
import minifyHexCode from 'minify-hex-code';
// or
const minifyHexCode = require('minify-hex-code');
```And execute the script:
```js
const shortHexCode = minifyHexCode('#000000'); // #000
const shortHexCode = minifyHexCode('#eeeeee'); // #000
const shortHexCode = minifyHexCode(); // throws error
```## Contributing
Fork the repo and clone locally, then run:
```bash
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:```sh
yarn run lint # lints js
yarn test # runs test suite
```If all tests pass, [create a pull request](https://github.com/nielse63/minify-hex-code/pulls).