MCPcopy Index your code
hub / github.com/davidmerfield/randomColor / pickSaturation

Function pickSaturation

randomColor.js:146–175  ·  view source on GitHub ↗
(hue, options)

Source from the content-addressed store, hash-verified

144 }
145
146 function pickSaturation(hue, options) {
147 if (options.hue === "monochrome") {
148 return 0;
149 }
150
151 if (options.luminosity === "random") {
152 return randomWithin([0, 100]);
153 }
154
155 var saturationRange = getSaturationRange(hue);
156
157 var sMin = saturationRange[0],
158 sMax = saturationRange[1];
159
160 switch (options.luminosity) {
161 case "bright":
162 sMin = 55;
163 break;
164
165 case "dark":
166 sMin = sMax - 10;
167 break;
168
169 case "light":
170 sMax = 55;
171 break;
172 }
173
174 return randomWithin([sMin, sMax]);
175 }
176
177 function pickBrightness(H, S, options) {
178 var bMin = getMinimumBrightness(H, S),

Callers 1

randomColorFunction · 0.85

Calls 2

randomWithinFunction · 0.85
getSaturationRangeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…