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

Function _rgb2hex

pattern/canvas.js:750–760  ·  view source on GitHub ↗
(r, g, b)

Source from the content-addressed store, hash-verified

748// Based on: http://www.easyrgb.com/math.php
749
750function _rgb2hex(r, g, b) {
751 /* Converts the given R,G,B values to a hexadecimal color string.
752 */
753 parseHex = function(i) {
754 return ((i == 0)? "00" : (i.length < 2)? "0"+i : i).toString(16).toUpperCase();
755 }
756 return "#"
757 + parseHex(Math.round(r * 255))
758 + parseHex(Math.round(g * 255))
759 + parseHex(Math.round(b * 255));
760}
761
762function _hex2rgb(hex) {
763 /* Converts the given hexadecimal color string to R,G,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…