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

Function getMinimumBrightness

randomColor.js:243–262  ·  view source on GitHub ↗
(H, S)

Source from the content-addressed store, hash-verified

241 }
242
243 function getMinimumBrightness(H, S) {
244 var lowerBounds = getColorInfo(H).lowerBounds;
245
246 for (var i = 0; i < lowerBounds.length - 1; i++) {
247 var s1 = lowerBounds[i][0],
248 v1 = lowerBounds[i][1];
249
250 var s2 = lowerBounds[i + 1][0],
251 v2 = lowerBounds[i + 1][1];
252
253 if (S >= s1 && S <= s2) {
254 var m = (v2 - v1) / (s2 - s1),
255 b = v1 - m * s1;
256
257 return m * S + b;
258 }
259 }
260
261 return 0;
262 }
263
264 function getHueRange(colorInput) {
265 if (typeof parseInt(colorInput) === "number") {

Callers 1

pickBrightnessFunction · 0.85

Calls 1

getColorInfoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…