Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including color-conv with all npm packages installed. Try it out:

var colorConv = require("color-conv")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

color-conv v0.1.3

Convertion between colors

color-conv

Build Status

Install

npm install color-conv

Usage

var cc = require('color-conv');

cc.schemas; // ['rgba', 'rgb', 'hex', 'hsla', 'hsl']
cc.support('hex'); // true
cc.support('abc'); // false

var color = cc.rgba(12, 34, 56, 0.5);
color.str(); // rgba(12, 34, 56, 0.5)
color.arr(); // [12, 34, 56, 0.5]
color.rgb();
color.hex();
color.hsla();
color.hsl();

color = cc.rgb(12, 34, 56);
color.str();
color.arr();
color.rgba();
color.hex();
color.hsla();
color.hsl();

color = cc.hex('#aabbcc');
color.str(true); // #abc
color.str(); // #aabbcc
color.rgba();
color.hex();
color.hsla();
color.hsl();

color = cc.hsla(230, 65, 13, 0.6);
color.str();
color.arr();
color.rgba();
color.rgb();
color.hex();
color.hsl();

color = cc.hsl(230, 65, 13);
color.str();
color.arr();
color.rgba();
color.rgb();
color.hex();
color.hsla();

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free