Color.js
Color functions.
Browser and NW.js(node-webkit)
<script src="<module-dir>/lib/WebModule.js"></script><script src="<module-dir>/lib/ColorCatalog.js"></script><script src="<module-dir>/lib/Color.js"></script><script> console; // -> "rgba(255,0,0,1.00)"console; // -> "#ff0000"console; // -> 255console; // -> 1.0console; // -> 255console; // -> 1.0console; // -> [255, 0, 0, 255]console; // -> [0, 1, 0.5, 255]console; // -> [0, 1, 1, 255]console; // -> [0.29899999499320984, -0.16873599588871002, 0.5, 255]console; // -> [255, 255, 255, 255]console; // -> [255, 0, 0, 255] // --- convert ---var pixelData = 255 0 0 255; Color; // -> [0, 1, 0.5, 255]Color; // -> [0, 1, 1, 255]Color; // -> [0.29899999499320984, -0.16873599588871002, 0.5, 255] Color; // -> [255, 0, 0, 255]Color; // -> [255, 0, 0, 255]Color; // -> [255, 0, 0, 255] // --- effect ---var hue = 120; // Hue effect. -360..+360var saturation = 0; // Saturation effect. -1.0..+1.0var lightness = 0; // Lightness effect. -1.0..+1.0var alpha = 0; // Alpha effect. 0..255var hslA_effect = hue saturation lightness alpha ; Color; // -> [0, 255, 255, 255, ...]Color; // -> [0, 255, 0, 255, ...]Color; // -> [96, 74, 35, 255, ...]Color; // -> [192, 192, 192, 255] </script>
WebWorkers
;;;
Node.js
;;;