Repository navigation
M3: swatch libraries — library panel, generated libraries, save and load, gradient libraries (M3.56–M3.58) - #27
Merged
Merged
Conversation
Window > Swatch Libraries and the Swatches panel's library button open a
read-only, floating library panel (thumbnail and list views, find field,
libraries menu, previous/next arrows). Clicking a swatch adds it to the
document and applies it as one undo step; Shift/Cmd-clicks select swatches
and groups for Add to Swatches. Default Swatches restores missing defaults.
Libraries are computed in code (OKLCH, rounded to 8-bit sRGB): Web Safe 216,
Grays and Neutrals, Earth Tones, Skin Tone Ramps, Pastels, Brights,
Metallic Gradients, Perceptual Scales, Harmony Sets.
Commands: swatch.library.list, swatch.library.get, swatch.library.add
{library, names?, apply?, focus?}, swatch.resetDefaults {replace?};
UI command window.swatchLibrary {library}.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…m back
Save Swatch Library… (Swatches panel menu, libraries menu, Window menu)
opens a dialog: name, format and destination. .vcswatches is lossless JSON
(colour models, global, spot, gradients, groups), .gpl an RGB palette with
groups as comment headers, CSS custom properties with escaped names.
Libraries saved to the user library folder show under User Defined.
Other Library… (and opening a .vcswatches/.gpl file) loads a library or
another document's swatches into the library panel.
Commands: swatch.library.save {path?, format?, names?, name?, user?}
(no path returns {data}), swatch.library.load {path?|data?|dataBase64?,
name?}; UI: window.swatchLibrary.other, ui.saveSwatchLibrary (dialog
saveSwatchLibrary), window.userSwatchLibrary1..10.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Alt-drop replaces a swatch
Window > Swatch Libraries > Gradients lists five generated gradient
libraries (Spectrum, Sky, Neutral incl. fades to transparent, Duotone,
Radial Glows); the library panel's menu lists them too.
Swatch Options on a gradient swatch shows its name and the gradient; OK
renames it. Alt-dropping an edited gradient (or a colour) on a swatch of its
kind in the Swatches panel replaces it, via swatch.edit {paint}.
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). Swatch libraries: a library panel with our own code-generated libraries, saving and loading libraries, and gradient libraries. Nothing is taken from Illustrator's bundled libraries; every palette is computed and named by us.
swatch.library.list,swatch.library.get {library},swatch.library.add {library, names?, apply?, focus?}(skips swatches the document already has),swatch.resetDefaults {replace?}. UI commandwindow.swatchLibrary {library}.panels/library_panel.rsis generic (LibraryKind), so graphic style libraries can reuse it.color/src/palette_io.rs):.vcswatches(lossless JSON: models, global, spot, groups);.gplpalettes (RGB,# Group:headers, other tools' comments and headers read); CSS custom properties (escaped, write-only).swatch.library.save {path?, format?, names?, name?, user?}returns{data}without a path.swatch.library.load {path?|data?|dataBase64?, name?}also loads another document's swatches.<prefs dir>/Swatches, they appear under User Defined..vcswatchesor.gplfile opens in the library panel, and the open dialogs gain a "Swatch libraries" filter.swatch.edit {paint?}replaces a swatch's paint with one of the same kind, and Alt-dropping a paint on a matching swatch uses it.docs/mcp.mdanddocs/control-protocol.mdcover the commands and thesaveSwatchLibrarydialog.Known limits:
Checks
Rebased onto
1ea13b5(#26).cargo xtask cipasses all 7 steps on this tree: 1,530 tests, 0 failed.New tests:
.vcswatchesround-trips CMYK, spot and groups;.gplheaders and comments;🤖 Generated with Claude Code