Repository navigation
Merge a color into a touching or similar one, pick colors from the image, and dim the rest - #254
Merged
Merged
Conversation
…m the rest Clicking a swatch opens a "Merge into…" popover with touching and closest-ΔE targets, or any color clicked on the image, previews the merge live on the canvas with a before/after inset, and applies it as one Undo step. Recolor… keeps the color picker. Pick from image turns the canvas into an eyedropper that selects a pixel's swatch, and hovering or opening a swatch dims every other color. Merge replaces Delete and rewrites only that color's pixels as exact RGBA (src/lib/colorMerge.ts): no requantize, the target's alpha is kept, and partly transparent pixels elsewhere stay as they were. Recolor shares the remap. The override-palette quantize path that only Delete used is removed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A merge in progress blocks another one; crop and processing close the popover and disable Pick from image; colors are kept as RGBA, so a color picked beyond the listed swatches is a valid source or target. The highlight and merge preview keep live adjustments, reuse one readback, buffer and source scan per selection, and rebuild a hover after it settles. Only keyboard focus highlights a swatch; Recolor moves focus into the picker and back. Escape in another dialog no longer leaves pick mode. The browser test now compares every pixel before the merge, after it, and after Undo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A selection and its target belong to the committed image they were chosen on, so a new image, an edit, or Undo closes the popover instead of carrying a merge over, and the canvas only samples pixels once the current image has loaded. A merge holds the shared image-edit lock while it encodes, and Undo, Redo, Quantize, crop, file picks, and the sidebar wait for it. Dismissing the popover by clicking elsewhere keeps that control's focus. The inset copies only its own area, pick mode frees its pixel copy when it ends, and the unused override-palette progress string is removed. The list-view browser test now merges into a semi-transparent color picked on the canvas that no suggestion row offers, and checks its alpha and Undo. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A merge waits for touch-ups still being saved, so a stroke keeps its own Undo step, then takes the edit lock from the latest render. An open Recolor dialog closes when the image changes. Touching suggestions keep only the top four while tallying, focus falls back to the colors list when the opened color has no listed swatch, touch-up tools draw on the live image instead of a highlight, and the pick-mode cache release no longer rebuilds the highlight. The list-view browser test now applies Recolor with alpha 0 and undoes it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merge and Recolor take the edit lock at once, on the image the selection belongs to, and don't start while a touch-up is still being saved; the popover or dialog then stays open, and the stroke landing closes it like any edit. This replaces waiting for the touch-up, which could drop the merge or move it to another image. Focus stays in the card while the colors are recounted, Recolor closing on an image change keeps focus there too, touching ties compare packed colors, and the leftover slice is gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A failed readback releases the edit lock and leaves the popover open, a stroke still being drawn counts as pending, Recolor Apply keeps focus in the card through the recount, and a selection made on an earlier image is dropped so it doesn't keep that image's pixels alive. Adds a unit test for the touching tie order with alpha variants and transparency. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A full-image readback that fails leaves the normal canvas and editing alone instead of throwing during render, the focus-return flag resets whenever another swatch opens, the popover scrolls within the space a short window leaves, and picking waits while the colors are recounted after an edit, so a picked color always opens its popover. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Council round 7 nits: a full-image readback that failed on this image isn't retried on every pointer move, and picking falls back to reading the one pixel; clearing a canvas-picked target chip moves focus to the popover's close button. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A swatch now opens Merge into…, so the test clicks Recolor… first. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vycdev
force-pushed
the
t3/swatch-merge-into
branch
from
November 30, 2026 16:38
854f848 to
0a722aa
Compare
vycdev
added a commit
that referenced
this pull request
Nov 30, 2026
After #254, a swatch merge or recolor holds the image-edit lock through imageEditBusy, and refuses to start while a touch-up stroke is saved. Block Clean edges and Merge small colors on the same conditions. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cleaning up colors meant guessing. You couldn't see where a 0.1% blur tone sat in the image or click it to find its swatch. Delete re-ran quantization with the remaining colors as a palette: it matched the target by RGB only and made every partly transparent pixel opaque.
Now a color can be merged into a neighbor in one click, with a preview first. This is decisions 2 and 3 (option A) of the approved color-cleanup plan.
Merge into…
Merging is a direct pixel remap, in the React-free
src/lib/colorMerge.ts:Merge safety
Pick from image and highlight
Screenshots (1600×1600 test image after K-means at 64 colors;
#411822is a 0.1% blur tone)Tests
tests/colorMerge.test.ts:@smoketests/e2e/image-colors-merge.spec.ts:tsc -b,npm test,test:i18n,check:i18n,test:docs, andtest:e2e:allonKROMACUT_E2E_PORT=49863.Docs and locales are updated in all 12 languages:
#219's worker is still a draft, so the remap runs on the main thread. It is one scan per selection and one per merge.
Council review
Rounds: 7
Fixed along the way:
Declined:
Created with Claude Opus 5.5 in Claude Code (T3 Code). Doc translations by a Claude Opus 5.5 subagent; reviews by Claude Opus 5.5 and GPT-6.2 Sol.
🤖 Generated with Claude Code