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

Function analog

pattern/canvas.js:886–897  ·  view source on GitHub ↗
(clr, angle, d)

Source from the content-addressed store, hash-verified

884}
885
886function analog(clr, angle, d) {
887 /* Returns a random adjacent color on the color wheel.
888 * Analogous color schemes can often be found in nature.
889 */
890 if (angle === undefined) angle = 20;
891 if (d === undefined) d = 0.1;
892 var hsb = _rgb2hsb(clr.r, clr.g, clr.b);
893 var hsb = _rotateRYB(hsb[0], hsb[1], hsb[2], Math.random() * 2 * angle - angle);
894 hsb[1] *= 1 - Math.random()*2*d-d;
895 hsb[2] *= 1 - Math.random()*2*d-d;
896 return new Color(hsb[0], hsb[1], hsb[2], clr.a, {"colorspace":HSB});
897}
898
899/*--- COLOR MIXIN ----------------------------------------------------------------------------------*/
900// Drawing commands like rect() have optional parameters fill and stroke to set the color directly.

Callers

nothing calls this directly

Calls 2

_rgb2hsbFunction · 0.85
_rotateRYBFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…