Skip to content

Commit

Permalink
fix: 🐛 all colors in pallette are same, pallette returns proper type
Browse files Browse the repository at this point in the history
  • Loading branch information
BlankParticle committed Jan 14, 2024
1 parent 3814e63 commit b46a0b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/quantize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class CMap {
}

public palette() {
return this.vBoxes.map(({ color }) => color);
return Array.from(this.vBoxes.map(({ color }) => color));
}

public get size() {
Expand Down Expand Up @@ -373,10 +373,10 @@ const quantize = (pixels: RgbTuple[], maxColors: number) => {
}

// do the cut
const vbox2 = medianCutApply(histogram, vbox)[1];
pq.push(vbox);
const [vbox1, vbox2] = medianCutApply(histogram, vbox);
pq.push(vbox1);
if (vbox2) {
pq.push(vbox);
pq.push(vbox2);
nColors++;
}
}
Expand Down

0 comments on commit b46a0b1

Please sign in to comment.