Merge pull request #6991 from dotCooCoo/feat/recolor-theme-picker

Recolor Artwork: the Color Theme Picker picks new colors from the art on the canvas
This commit is contained in:
BFlat
2026-11-13 08:31:13 +07:00
committed by GitHub
37 changed files with 1605 additions and 6 deletions
+21
View File
@@ -3668,6 +3668,27 @@ the library's colors. Colors that no row holds, such as preserved White and Blac
{"name":"run_command","arguments":{"command":"recolor.apply","params":{"map":{"#ff0000":"#ff0000","#0000ff":"#0000ff"},"globalAdjust":{"saturation":-40,"temperature":25}}}}
```
`recolor.pickTheme {picks, colors?}` is the dialog's Color Theme Picker: it returns the color palette of the art picked
as `colors` (keys, the most used first) and `objects` (how many objects it read), and changes nothing. Each pick is
`{at: [x, y]}`, a click that reads the object a Selection tool click there takes with everything inside it, or
`{rect: [x0, y0, x1, y1]}`, a marquee that reads every painted object it touches and the part of each image inside it
(document points; 1 to 256 picks, which add up). It reads visible fills and strokes, gradient stops, text, mesh points,
pattern tiles (with the patterns they use), the art of symbol instances (placed through their 9-slice guides), the
colorize color of an image it applies to and the pixels of other images: at most 65,536 pixels of each pick of an
image, spread evenly, and 1,048,576 pixels of at most 64 images in all, leaving out pixels less than half opaque and
images it can't decode; each image is decoded once for all its picks. In a clip group, or under an opacity mask that
clips, it reads only what shows inside the clipping path or the mask art, and a blend, envelope or repeat that a
marquee touches is read whole. Hidden or fully transparent objects and fill or stroke items are left out, and locked
objects are read. As VectorCraft's own rule, each object read weighs the same, shared among its colors (an image's
among its pixels; the vector art a symbol instance places counts as one object, and each image it places counts on
its own), and similar colors merge (k-means in Lab) into at most `colors` (1 to 64, default 5), each shown by its
most used color in its own model. Picks that touch no art return no colors. In the Recolor Artwork dialog the picks are the `themePicks` field: the rows that aren't
excluded take the palette as their new colors in row order, the colors repeating when the rows outnumber them.
```json
{"name":"run_command","arguments":{"command":"recolor.pickTheme","params":{"picks":[{"at":[120,80]},{"rect":[200,40,320,140]}],"colors":4}}}
```
The `recolor.*` commands refuse parameters of the wrong form. A `limitTo` or `method` that is not a string gets the
error for an unknown library or method. Other wrong-form parameters get an error that names them.
`includeImages`, `includePatterns`, a row's `exclude`, `order`, `saturationBrightness` and the `white`, `black` and
+2
View File
@@ -482,6 +482,8 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
- [x] Recolor Artwork › Assign: double-click a row's new color to pick it in the Color Picker, in the model it was picked in (part of #4028); a Lab new color is kept but can't be typed yet (the picker's Lab fields work in RGB); Lab entry, swatch libraries and the row menu remain.
- [x] Recolor Artwork › Color Theme Picker: with the button beside the tabs on, a click on the canvas takes the color palette of an object or image, a drag takes the palette of the art inside its marquee, and Shift adds more picks; the rows that aren't excluded take the palette as their new colors and the art previews them ([Recolor artwork](https://helpx.adobe.com/illustrator/desktop/manage-colors/modify-colors/recolor-artwork.html)). The number and order of the picked colors are VectorCraft's own rule (`recolor.pickTheme`). Tests: `theme_picks_give_the_rows_the_palette_of_the_art_picked` and `the_theme_picker_takes_clicks_and_shift_drags_on_the_canvas` in `crates/ui-egui/src/dialogs/recolor.rs`, `theme_picker_*` in `crates/engine/src/tests/recolor.rs`.
- [x] Recolor Artwork Edit color chips scroll within the screen, preserving the wheel and actions (#3416); 5, 20, 200 and 400 colors, resizing and UI scaling, final-chip editing and preview/history covered by egui_kittest.
- [x] Status messages and bounded readouts remain stable as values, canvas hover and background jobs change; ordinary values fit all registered languages and units, and optional groups yield in narrow windows (regressions; contributor rebuilt and confirmed the original-file status-bar scenario on 2026-10-19). Sample widths are cached per UI and refreshed only when language, document units or pixels per point changes.