A Color object to manage those pesky CSS color strings
A Color object to manage those pesky CSS color strings.
Since CSS3 string tags becoming popular, Canvas rendering becoming viable, and SVG joining the embedded workspace, color matching has become increasingly difficult to get right when you start off with
hsl, need to transfer to an
rgb, but then need to display in hexadecimal in order to properly display it round circle.
Color is similar to the
Using the Color operates by creating your color, or editing an existing one.
var myColor = 'red';// 255console.logmyColorred;// 0console.logmyColorgreen;// 0console.logmyColorblue;
After creating your color, you can start changing your colors around.
// Update the dimensionsmyColorred = 200;myColorgreen = 100;myColorblue = 22;
After adjusting your color to the right values (0-255 for rgb), you can translate it back for use with the DOM.
// rgb(200, 100, 22)myColortoRGBString;
If you find yourself using Color and want to make updates:
This project uses an MIT license. Please refer to the LICENSE file or source code doc block for reference.