Repository navigation
[minor] Add SwatchPalette, a selectable, drag-reorderable grid of colour swatches - #571
Merged
Merged
Conversation
…our swatches A wrapping grid of swatches over a caller-owned IList<Color>. Clicking a swatch selects it; dragging one reorders the list in place, with the selection following the swatch it named. Adding, removing and editing colours stays with the host. The layout, hit-testing, drop slot, move and drag tracking live in SwatchPaletteState with no ImGui dependency. The grid and each swatch are probe-marked. Adds a demo section, an isolation suite, a gallery tile and the image and colour docs entries. Closes #530 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXUsRiHnKs6HCgLAbC1L6D
This was referenced Sep 30, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgjMCJ9MQRmUk6c8KABDYH
SonarCloud's S2184 flags int.MinValue / 2 and int.MaxValue / 2 passed where floats are expected, since an integer division feeding a float usually means a lost fraction. Nothing was lost here, but a named float bound says what the clamp is for: keeping the cast back to int from overflowing. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXUsRiHnKs6HCgLAbC1L6D
|
This was referenced Oct 1, 2026
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.



Requested by Matt · project thread
Before:
ktsu.ImGui.Widgetshad no palette widget. A host that wanted a pickable, reorderable set of colours had to lay out and hit-test swatches itself.After:
ImGuiWidgets.SwatchPalettedraws a wrapping grid of swatches over a caller-ownedIList<Color>. Clicking a swatch selects it. Dragging one reorders the list in place, and the selection follows the swatch it pointed at. Adding, removing and editing colours stay with the host.How:
SwatchPaletteStateholds the layout, hit-testing, drop slot, move and drag tracking, and has no ImGui dependency. The grid and each swatch are probe-marked. This adds a demo section, an isolation suite, a gallery tile, and entries in the image and colour docs group.Stacked PR. #570 (GradientEditor) has merged, so this now targets
mainand is the next one to merge. Merge order: this → ImageCompare (#572) → CropOverlay (#573) → PixelLoupe (#574).Validation, Release build: the solution builds clean,
ImGuiWidgetsDemo.UITestspasses 44/44,ImGui.Widgets.UITestspasses 900/900, andWidgetGallery --checkpasses.Closes #530
🤖 Generated with Claude Code
https://claude.ai/code/session_01LXUsRiHnKs6HCgLAbC1L6D