Skip to content

Latest commit

 

History

History
110 lines (54 loc) · 1.1 KB

README.md

File metadata and controls

110 lines (54 loc) · 1.1 KB

colorjs

Install Colorjs

Node.js

  npm install colorjs

ES6

  import colorjs from 'colorjs';

  colorjs('#fff').format('RGB');

Document

Parse

RGBHex

  colorjs('#fff');

  colorjs('#000000');

RGB

  colorjs({ r: 255, g: 255, b: 255 });

HSL

  colorjs({ h: 300, s: 100, l: 100 });

HSV

  colorjs({ h: 300, s: 100, v: 100 });

Format Type

colorjs(clolorString, formatType);

  colorjs('#fff', 'RGBHex');

  colorjs('255, 255, 255', 'R, G, B');

  colorjs('300 100 100', 'H S L');

Display

  colorjs('#fff', 'RGBHex').format('R, G, B');  // '255, 255, 255'

  colorjs('255, 255, 255', 'R, G, B').format('RGBHex');  // '#ffffff'

  colorjs('300 100 100', 'H S L').format('HSL'); // { h: 300, s: 100, l: 100 }

Manipulate

Add

  colorjs('#000').add('r', 255);  //#ff0000

Subtraction

  colorjs('#fff').sub('r', 255);  //#00ffff

Query

Random