Skip to content

nielse63/expand-hex-code

Repository files navigation

expand-hex-code

Build Status Coverage Status devDependencies Status Code Climate NPM version npm Greenkeeper badge

Expand hex codes from three to six digits

Installation

With npm

npm install expand-hex-code

With yarn

yarn add expand-hex-code

Usage

In a node project

Import the script to your project

import expandHexCode from "expand-hex-code";
// or
const expandHexCode = require("expand-hex-code");

And execute the script:

const hexCode = expandHexCode("#000"); // #000000
const hexCode = expandHexCode("#cb0"); // #ccbb00
const hexCode = expandHexCode("#ffffff"); // #ffffff

Contributing

Fork the repo and clone locally, then run:

yarn install

This will install the devDependencies packages and build the dist folder.

Once you've made your desired changes, make sure to write any new tests for your feature and run the tests:

yarn test

If all tests pass, create a pull request.