Repository navigation
M3: Color Guide rules and options, Edit Colors dialogs, recolouring meshes, images and patterns (M3.53–M3.55) - #21
Merged
Merged
Conversation
… a fixed base colour and Save Colors as Swatches
The harmony rules (Complementary 1/2, Split Complementary, Left/Right Complement, Analogous 1/2,
Monochromatic, Shades, Triad 1-3, Tetrad 1-3, Compound 1/2, High Contrast 1-3, Pentagram) live in
the color crate with our own math, base colour first. The variation grid moves there too
(`harmony::Guide`): a row per harmony colour with the colour in the centre column, shades/cool/muted
to the left and tints/warm/vivid to the right, 1-20 steps and a variation amount.
- `color.harmony {color, rule, steps?, variation?, amount?}` query returns {rule, colors, grid}.
- The panel keeps its base colour until "Set base color" takes the current one; Shift/Cmd-click
selects several cells and Save Colors as Swatches saves them (`swatch.new {colors}`, one step).
- Color Guide Options dialog (`ui.colorGuideOptions`, kind `colorGuideOptions`) with a preview row;
the options persist in `UiState::color_guide`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ommitted as one undo step - Edit > Edit Colors > Adjust Color Balance... opens Adjust Colors (`ui.colorBalanceDialog`, kind `colorBalance`): colour mode Grayscale, RGB, CMYK or Global, a slider and field per channel (-100..100 %), Convert, Fill and Stroke, and Preview. - Saturate... opens Saturate (`ui.saturateDialog`, kind `saturate`): Intensity -100..100 % and Preview. - Both preview through the session interaction (fields changed by `ui.dialog.set` preview on the next frame too); OK keeps the result as one undo step, Cancel rolls it back. - `edit.colors.adjustBalance` takes `mode` (rgb|cmyk|gray|global; default from the channels given). Global mode needs tints of global and spot colours and answers with a clear error until they exist; the dialog stays open and the colours keep their links. - Shared dialog helpers: `form::slider`, `form::preview`, `form::commit_preview`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… embedded images and pattern fills
One shared colour visitor (`colorcmds::Recolor`, used by Edit Colors, Recolor Artwork, the Blend
commands, the proxy Invert/Complement and Document Color Mode) maps solid colours, gradient stops
and text runs as before, and now also:
- gradient-mesh points (with fills); Blend grades meshes by their average and keeps their shading;
- embedded images' pixels (`includeImages?`, default on): the image becomes a recoloured copy under
a content key, the original stays for undo and other objects; linked images are left alone;
- the tiles of pattern fills and strokes (`includePatterns?`, default on): one recoloured copy per
pattern saved as a new pattern swatch ("Dots 2"), the original untouched.
Everything stays one undo step; only nodes that change are copied, in one walk of the tree.
- doc: `ImageBlob::map_rgb` (decode, map each distinct colour once, keep alpha, re-encode PNG),
`ImageBlob::content_key` (now also used by image import) and `ImageBlob::png`.
- `recolor.colors` lists mesh points and pattern tile colours too.
- patterncmds: `add_pattern` adds a pattern and its swatch (shared by Make Pattern and Save a Copy).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of M3 (Paint & appearance). The Color Guide gets its full rule set and options, Edit Colors gets real dialogs, and colour edits reach meshes, images and patterns.
color/harmony.rs. Each returns the base colour first, unchanged and in its own colour model.Variation,GuideOptions(steps 1–20, amount) andvariation()moved into the color crate.color.harmony {color, rule, steps?, variation?, amount?}returns{rule, colors, grid}.colorGuideOptions) with a preview row.swatch.new: takescolors: [...]and makes one swatch per colour in one undo step.colorBalance: Grayscale/RGB/CMYK/Global, Convert, Fill/Stroke) and Saturate (saturate).session.previewand commit as one undo step; Cancel rolls back.form::slider,form::previewandform::commit_preview.colorcmds::Recolor) serves Edit Colors,recolor.apply, Blend, proxy Invert/Complement and Document Color Mode. It copies only the nodes it changes.includeImages?). Linked images are skipped.includePatterns?); the original pattern stays as it is.doc/pixels.rs(ImageBlob::map_rgb,content_key).keep_model).docs/mcp.mdanddocs/control-protocol.mdcover the query and the three dialogs.Known limits:
color.harmony.Checks
Rebased onto
6c25e54(#20).cargo xtask cipasses all 7 steps (fmt, clippy, test, assets, brands, layers, wasm): 1,463 tests, 0 failed.New tests:
🤖 Generated with Claude Code