Skip to content

Check several quantization palettes at once - #262

Merged
vycdev merged 9 commits into
developfrom
t3/multi-palette-select
Nov 30, 2026
Merged

vycdev merged 9 commits into
developfrom
t3/multi-palette-select

Conversation

@vycdev

@vycdev vycdev commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

Supersedes #218 by @JohnSt99, keeping its multi-select picker and dropping its separate Number of Colors step. Closes #167.

What changes for users

  • The Palette field is a list with a checkbox on each palette, so built-in, supplier and custom palettes can be checked together. Apply maps to the enabled colors of every checked palette; a color shared by several counts once. Keep detail and the palette gap note (Keep detail and a palette gap note for fixed palettes #253) cover all checked palettes, and the note hides when the checked set or its colors change.
  • The field reads "2 palettes · 34 colors" with chips, and Number of Colors shows the combined count. Checking Auto unchecks the rest.
  • With one palette checked, output is byte-identical to develop. One palette resolves to its own color array, untouched. A test pins this against the pre-change goldens, with Keep detail off and on, plus a custom palette that has a disabled color.
  • Edit, Clone, Export and Delete act on one palette, so they're available while exactly one is checked. Create, clone and import check only the new palette, as they selected it before.
  • Keyboard: Arrow Down/Up opens the list on the first checked row; arrows, Home and End move; Space and Enter toggle; Tab and Shift+Tab close the list and move on. The trigger's aria-controls points at the multi-select listbox.

#218's reduce-then-match step isn't here. It merged the image down before matching, which loses the detail Keep detail protects, and it changed results for every fixed-palette user.

Persistence

  • The checked list is saved under a new kromacut.palettes.selectedIds key. A choice saved under kromacut.palettes.selected opens checked.
  • kromacut.palettes.selected keeps the first checked palette (or auto), so an older version still opens with it. If an older version changes that key later, its choice wins.
  • At storage quota a reload never shows palettes that weren't checked together. The worst case is the first checked palette alone.
  • The reserved-id migration in loadCustomPalettes moves every checked id.

Project files (#220)

#220 (.kproj save/load) is still a draft and stores a single quantize.paletteId. Whichever lands second should store the list (selectedPaletteIds from usePaletteManager) and still open files that store one paletteId.

Tests

  • tests/paletteSelection.test.ts: the single-palette byte goldens; the union's order and dedup; Keep detail and the gap covering both palettes.
  • tests/paletteManager.test.ts: migrating the old key, downgrade and upgrade, and each quota failure path.
  • e2e: palette-management.spec.ts checks two palettes, reloads, and walks the keyboard. quantize-determinism.spec.ts applies with grays + Bambu checked and checks that black survives.
  • Docs in all 12 languages, plus the CHANGELOG.

Checks: lint, tsc -b, npm test (1414 pass, 1 skipped), test:i18n, test:docs, and test:e2e:all on port 52383 (all 8 suites pass, no port collisions). After merging the latest develop (#257, #260), the palette, quantize and desktop-import e2e specs pass again (34/34).

Council review

Gemini isn't reachable from this environment (only Claude and Codex are enabled), so the council had two members.

Rounds: 6

Delegate Round 1 Round 2 Round 3 Round 4 Round 5 Round 6
Claude Opus 5.5 8.5/10 9/10 9/10 9/10 9/10 9.5/10
GPT-6.2 Sol 8/10 8/10 8/10 8/10 8.5/10 9/10
Gemini Pro unavailable unavailable unavailable unavailable unavailable unavailable

Fixed:

  • Storage at quota: a key that couldn't be written could make a stale value win. Rounds 1–4 converged on one rule: a reload never shows palettes that weren't checked together.
  • The trigger's aria-controls points at the listbox. Arrow keys open the list. The supplier disclaimer describes its group instead of sitting inside the listbox as text.
  • Tab and Shift+Tab leave the list, also after a click on its padding or a heading, which leaves focus on the popup itself.
  • Auto brings a combined count back into 2–256. The list fits the space left in the window.
  • The e2e test now applies with two palettes and waits for the mapped pixels, not the source capture.

Declined as scope: typeahead in the list, and some cosmetic notes (Space on the popup itself scrolls it, Radix's unnamed dialog wrapper, chips crowding the summary at minimum sidebar width).

🤖 Generated with Claude Code

vycdev and others added 8 commits November 30, 2026 22:23
The Palette field becomes a multi-select list with a checkbox per palette.
Apply maps to the enabled colors of every checked palette combined, a
shared color counted once, and Keep detail and the palette gap note cover
all of them. One checked palette maps to its own color list unchanged, so
its output stays byte-identical. Number of Colors stays palette-determined;
there is no separate pre-merge step.

The checked list is saved under kromacut.palettes.selectedIds. A choice
saved under kromacut.palettes.selected opens checked, and that key keeps
the first checked palette for older versions.

Co-authored-by: JohnSt99 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…rrow key

A storage key that cannot be written is removed, so a stale single choice
no longer outvotes a saved list. The trigger points aria-controls at the
listbox and opens on Arrow Down/Up; the supplier disclaimer describes its
group instead of sitting in the listbox as text. Back on Auto, a combined
count above 256 returns within the field's limit. An e2e Apply now maps
with two palettes checked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t on Tab

A list write that fails no longer deletes the last saved list; it is read
while the single choice still names its first palette. Only a single
choice that cannot be written is removed. Tab closes the palette list back
to its field, and Auto brings a palette's count into 2 to 256. The
two-palette e2e Apply now waits for the mapped stripes themselves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Removing the single choice after both writes failed could bring back an
older list. It is now removed only when the list was saved. The palette
list also fits the space left in the window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When the checked list cannot be written, the last saved list is removed
and the write tried once more in the space it held; if that also fails,
the first checked palette loads alone. A stale list can no longer return
palettes the user unchecked. Tab and Shift+Tab from the open list move on
from the Palette field instead of stopping on it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After a click on the popup's padding or a group heading, focus sits on the
popup itself, where Tab was swallowed and the arrow keys did nothing. The
keys are now handled there, before Radix's focus scope. The storage comment
now says what loads when neither key can be written.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vycdev
vycdev merged commit 5ed8365 into develop Nov 30, 2026
14 checks passed
vycdev added a commit that referenced this pull request Dec 1, 2026
develop's multi-palette select (#262) replaces the single selected palette
with a list. Projects now save the checked palette IDs and a snapshot of
each checked custom palette, and still open version 1 files that stored a
single paletteId and palette. Opening restores every checked palette the
same way as before: built-ins by ID, custom palettes as copies unless an
identical one exists, without overwriting library palettes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant