Color-string

color-string

Parser and generator for CSS color strings!

A module by Heather Arthur helps us to generator and parser CSS color strings.

The API names are pretty self explainatory, the module has the below methods:

Methods for parsing:

  • getRgba

  • getHsla

  • getRgb

  • getHsl

  • getHwb

  • getAlpha

Methods for generating:

  • hexString

  • rgbString

  • rgbaString

  • percentString

  • percentaString

  • hslString

  • hslaString

  • hwbString

  • keyword

Install it: npm install --save color-string

Sample usage:

1
2
3
4
5
var colorString = require('color-string');

colorString.getRgb("#FFF")  // [255, 255, 255] 

colorString.keyword([255, 255, 0])       // "yellow" 

GIF FTW!

color-string

Suggest a module

Comments