Skip to content

Commit

Permalink
#1
Browse files Browse the repository at this point in the history
  • Loading branch information
utubo committed Aug 27, 2021
1 parent e0c9539 commit 5432f1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@ document.getElementById('file_pic').addEventListener('input', async e => {
// Remove too bright and too dark.
const minL = (brightest.l - darkest.l) * 2 / 5 + darkest.l;
const maxL = (brightest.l - darkest.l) * 4 / 5 + darkest.l;
pixels = picks.filter(c => (minL < c.l && c.l < maxL));
pixels = pixels.filter(c => (minL < c.l && c.l < maxL));
// Remove gray.
pixels.sort((a, b) => b.s - a.s);
const minS = pixels[0].s / 4;
pixels = picks.filter(c => minS < c.s);
pixels = pixels.filter(c => minS < c.s);
// Sort by hue.(0=red, 90=yellow, 180=green, 270=blue)
pixels.sort((a, b) => a.h - b.h);
const quoter = a => pixels[Math.floor(picks.length * a / 4)];
const quoter = a => pixels[Math.floor(pixels.length * a / 4)];
applyOneColor('b4', toHex(quoter(3)));
applyOneColor('g4', toHex(quoter(2)));
applyOneColor('y4', toHex(quoter(1)));
Expand Down

0 comments on commit 5432f1a

Please sign in to comment.