Open the Color Picker from every colour swatch - #10
Merged
Conversation
Clicking the swatch on Layer Style's Color row did nothing, which is the one thing the control looks like it should do. The reason it did nothing is that `Workspace::modal` is a single `Option<Modal>` and the picker is itself a `Modal`, so opening it would have thrown away the Layer Style session mid-edit. So modals get a suspend stack: `open_color_picker_on` pushes the dialog that is already up, and `close_modal` pops it back rather than clearing, whether the picker was OK'd or cancelled. `modal` stays the top of the stack, so the dozen places that read it -- the renderer, the key routing, the "is a dialog up" guards -- carry on unchanged. `open_modal` clears the stack, so a dialog launched from the menus still replaces everything. Three swatches wanted this, not one: - Layer Style's per-effect Color, via `ColorTarget::StyleEffect(key)`. OK writes through `set_color` and re-previews the layer, the same path the sliders use, so the canvas keeps up. - Gradient Overlay's From and To, which had no swatches at all -- only the "From = FG" / "To = FG" buttons, so the two colours were reachable only by way of the foreground. They ride the same variant under dotted keys, `gradient_overlay.from` and `.to`, since they are ends of a gradient rather than "the effect's colour" and have no slot in `color_of`. - Select > Color Range's Sampled, which needs its own variant because it writes back to a different modal. Driven headlessly to check the parts that are easy to get wrong: OK restores the parent dialog with every other control intact, Cancel and Escape restore it with the colour unchanged, and the parent's own OK/Cancel still commit and revert. Co-Authored-By: Claude Opus 5 (1M context) <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.
Clicking the swatch on Layer Style's Color row did nothing, which is the one thing the control looks like it should do.
The reason it did nothing is that
Workspace::modalis a singleOption<Modal>and the picker is itself aModal, so opening it would have thrown away the Layer Style session mid-edit. So modals get a suspend stack:open_color_picker_onpushes the dialog that is already up, andclose_modalpops it back rather than clearing, whether the picker was OK'd or cancelled.modalstays the top of the stack, so the dozen places that read it -- the renderer, the key routing, the "is a dialog up" guards -- carry on unchanged.open_modalclears the stack, so a dialog launched from the menus still replaces everything.Three swatches wanted this, not one:
ColorTarget::StyleEffect(key). OK writes throughset_colorand re-previews the layer, the same path the sliders use, so the canvas keeps up.gradient_overlay.fromand.to, since they are ends of a gradient rather than "the effect's colour" and have no slot incolor_of.Driven headlessly to check the parts that are easy to get wrong: OK restores the parent dialog with every other control intact, Cancel and Escape restore it with the colour unchanged, and the parent's own OK/Cancel still commit and revert.