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

Function _hsb2rgb

pattern/canvas.js:794–810  ·  view source on GitHub ↗
(h, s, v)

Source from the content-addressed store, hash-verified

792}
793
794function _hsb2rgb(h, s, v) {
795 /* Converts the given H,S,B color values to R,G,B (between 0.0-1.0).
796 */
797 if (s == 0) {
798 return [v, v, v];
799 }
800 h = h % 1 * 6.0;
801 var i = Math.floor(h);
802 var f = h - i;
803 var x = v * (1-s);
804 var y = v * (1-s * f);
805 var z = v * (1-s * (1-f));
806 if (i > 4) {
807 return [v, x, y];
808 }
809 return [[v,z,x], [y,v,x], [x,v,z], [x,y,v], [z,x,v]][parseInt(i)];
810}
811
812function darker(clr, step) {
813 /* Returns a copy of the color with a darker brightness.

Callers 5

canvas.jsFile · 0.85
darkerFunction · 0.85
lighterFunction · 0.85
adjust_hueFunction · 0.85
blendFunction · 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…