MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / prepColors

Function prepColors

src/content/Backgrounds/Lightfall/Lightfall.jsx:15–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13};
14
15const prepColors = input => {
16 const base = (input && input.length ? input : ['#A6C8FF', '#5227FF', '#FF9FFC']).slice(0, MAX_COLORS);
17 const count = base.length;
18 const arr = [];
19 for (let i = 0; i < MAX_COLORS; i++) arr.push(hexToRGB(base[Math.min(i, base.length - 1)]));
20 const avg = [0, 0, 0];
21 for (let i = 0; i < count; i++) {
22 avg[0] += arr[i][0];
23 avg[1] += arr[i][1];
24 avg[2] += arr[i][2];
25 }
26 avg[0] /= count;
27 avg[1] /= count;
28 avg[2] /= count;
29 return { arr, count, avg };
30};
31
32const vertex = `
33attribute vec2 position;

Callers 1

LightfallFunction · 0.70

Calls 1

hexToRGBFunction · 0.70

Tested by

no test coverage detected