Skip to content

Commit

Permalink
Fix palette
Browse files Browse the repository at this point in the history
  • Loading branch information
zk-phi committed Jun 24, 2024
1 parent 8de8b0e commit c4cc208
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/gifworker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ctx.addEventListener("message", (msg) => {
palette.pop();
}
const colorFinder = genColorFinder(palette);
const transparentIndex = palette.length;
const transparentIndex = palette.length; // entry will be added later
frames.forEach((frame, frameIx) => {
// dither and binarize transparency first
if (transparent) {
Expand All @@ -65,7 +65,7 @@ ctx.addEventListener("message", (msg) => {
}
}
encoder.writeFrame(indexed, width, height, {
palette: frameIx === 0 ? palette : undefined,
palette: frameIx === 0 ? (transparent ? [...palette, [0, 0, 0]] : palette) : undefined,
delay,
transparent,
transparentIndex,
Expand Down

0 comments on commit c4cc208

Please sign in to comment.