MCPcopy Create free account
hub / github.com/davidmerfield/randomColor / getHueRange

Function getHueRange

randomColor.js:264–286  ·  view source on GitHub ↗
(colorInput)

Source from the content-addressed store, hash-verified

262 }
263
264 function getHueRange(colorInput) {
265 if (typeof parseInt(colorInput) === "number") {
266 var number = parseInt(colorInput);
267
268 if (number < 360 && number > 0) {
269 return [number, number];
270 }
271 }
272
273 if (typeof colorInput === "string") {
274 if (colorDictionary[colorInput]) {
275 var color = colorDictionary[colorInput];
276 if (color.hueRange) {
277 return color.hueRange;
278 }
279 } else if (colorInput.match(/^#?([0-9A-F]{3}|[0-9A-F]{6})$/i)) {
280 var hue = HexToHSB(colorInput)[0];
281 return [hue, hue];
282 }
283 }
284
285 return [0, 360];
286 }
287
288 function getSaturationRange(hue) {
289 return getColorInfo(hue).saturationRange;

Callers 1

pickHueFunction · 0.85

Calls 1

HexToHSBFunction · 0.85

Tested by

no test coverage detected