brandonmcconnell

Color Averaging (for Chromedi)

Mar 21st, 2022
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. const avgEach = (...arrays) => Array(arrays[0].length).fill().map((_, i) => arrays.reduce((a, c) => a + c[i], 0) / arrays.length);
  2. const setRgb = ([r,g,b]) => test.style.backgroundColor = `rgb(${r} ${g} ${g})`;
  3. const setHsl = ([h,s,l]) => test.style.backgroundColor = `hsl(${h}deg ${s}% ${l}%)`;
Advertisement
Add Comment
Please, Sign In to add comment