MCPcopy Index your code
hub / github.com/clips/pattern / _hex2rgb

Function _hex2rgb

pattern/canvas.js:762–773  ·  view source on GitHub ↗
(hex)

Source from the content-addressed store, hash-verified

760}
761
762function _hex2rgb(hex) {
763 /* Converts the given hexadecimal color string to R,G,B (between 0.0-1.0).
764 */
765 hex = hex.replace(/^#/, "");
766 if (hex.length < 6) { // hex += hex[-1] * (6-hex.length);
767 hex += (new Array(6-hex.length)).join(hex.substr(hex.length-1));
768 }
769 var r = parseInt(hex.substr(0, 2), 16) / 255;
770 var g = parseInt(hex.substr(2, 2), 16) / 255;
771 var b = parseInt(hex.substr(4, 2), 16) / 255;
772 return [r, g, b];
773}
774
775function _rgb2hsb(r, g, b) {
776 /* Converts the given R,G,B values to H,S,B (between 0.0-1.0).

Callers 1

canvas.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…