Color-Magic
A library for doing CSS color manipulation and conversion
Construction
let ColorMagic = ; // Can be constructed from all valid CSS color formatslet red = '#f00';let green = 'rgba(0,255,0,1)';let blue = 'blue'; // Can also construct from these formatslet grey = 128;let magenta = 255 255 0;let cyan = 0 255 255 05;let orange = 25516501;
Complementary colors and contrasting colors
// Find the font color that contrasts the best with out background colorlet background = 'black';let fontColor = ; // Get the inverse color of a given colorlet yellow = 'blue';
Mixing colors
// Add colorslet red = 'red';let green = 'green';let blue = 'blue'; let white = ; // Subtract colorslet black = white;
Building
To build, you need to have webpack installed. (npm install -g webpack
)
Simply run webpack
from this directory, and color-magic.js
and color-magic.js.map
will be built in the dist
folder.