Repository navigation
Replace iced_aw color picker with custom Select Color panel - #1
Closed
MarcelP102 wants to merge 14 commits into
Closed
MarcelP102 wants to merge 14 commits into
MarcelP102 wants to merge 14 commits into
Conversation
Replace the old index page and the iced_aw ColorPicker popup with one Select Color panel: - Index Color tab: standard colors, ACI 10-249 grid, grays; arrow keys move through the palette. - True Color tab: HSB, RGB and gradient-field modes built on two new widgets (GradientSlider, ColorArea) and iced_aw NumberInput boxes, an editable hex field and a nearest/exact index color button. - Current/New swatch: clicking Current reverts. A mixed selection opens on the color of the most recently drawn object with *VARIES* on top. - Color field accepts an index, a color name, r,g,b or hex. - Enter confirms, Esc cancels, other keys stay in the panel. - New labels translated in all 22 locales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
- Give the panel body room for the gray row and info line. - Keep NumberInput digits clear of its arrows and draw the arrows as plain icons in the text colour. - Split the Current / New swatch with a thin divider. - Load the iced_aw icon font in the headless snapshot test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
Draw the unit as the NumberInput icon on the right of the digits instead of a separate label beside the box. The unit is not part of the value, so users still only type the number. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
- ColorEditor: the HSB / RGB / field editor and hex box, now shared by the Select Color panel and the Options background swatches. Those swatches open the panel without tabs or index colours, which removes the iced_aw color_picker feature and the BgPicker messages. - Sliders are iced's built-in slider and vertical_slider over a gradient container; the custom GradientSlider widget is gone. - Nearest index colour comes from opencadcodec's aci_table::nearest_aci. - Eyedropper: a pipette at the right of the mode row hides the panel, captures the window with iced's screenshot task and shows an 11x11 magnifier beside a crosshair; a click picks the pixel, Esc backs out. Not offered on the web build. - The hex box applies six-digit values while typing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
- Current and New are a 50/50 band across the panel with their names and values inside; the Color text box is gone. - The gradient mode button is one gradient across the whole button, gray until that mode is active. Mode buttons share one width. - Tab and Shift+Tab move between the panel's own fields. - Number boxes are 54 px wide, the hex box 74 px. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
…s swatches - The gradient mode button is just its gradient, without a frame. - In the gradient view H, S and B sit on the left and Hex on the right of one row; the nearest index colour moves to the row below. - Every colour swatch in Options opens the Select Color panel: the six theme colours, crosshair, snap marker and command line text join the three viewport backgrounds. BgTarget becomes UiColor, and one color_swatch helper replaces the four hand-built swatches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
…picker - The gradient view no longer shows the nearest index colour. - Mode buttons are 44 x 24 and the pipette button matches their height. - Slider rows are 14 px apart and the gradient field is 108 px tall, so the hex value sits on the same row in the HSB, RGB and gradient views. - The interface colour picker (Options) shrinks to its content, ending just below the hex row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
- Keep the modal keyboard comment with the code it describes and match shortcut keys without an extra closure. - Drop unused ColorEditor::mode, EyedropperMsg::Cancel and a duplicate rgb helper; re-export nearest_aci instead of wrapping it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
- Split ColorEditor::view into mode_row, slider_rows, field_view, hex_row and hex_field; output is unchanged. - hex_string reuses config::rgb_to_hex, and parse_hex documents why it stays separate (it also accepts #RGB). - ink_is_dark uses Color::into_rgba8 instead of rounding by hand. - Remove four translation keys the old dialog used and nothing references any more, from the catalog and all 22 locales. - Eyedropper: without a main window there is no screenshot to wait for, so leave the eyedropper; keep the magnifier inside small windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
Resolve conflicts with the new gradient and graphic-attributes colour targets: keep main's targets and menu handling, routed through the new ColorPicker state; adapt dock/view.rs to `color_picker`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8
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.
This PR replaces the
iced_aw::ColorPickerwidget with a custom-built Select Color panel that provides a more comprehensive color selection experience aligned with CAD applications.Summary
The new Select Color panel (
ColorPicker) is a modal dialog that allows users to select colors through multiple interfaces: an indexed color palette (ACI 1-255), true color editing via HSB/RGB sliders or a saturation/brightness field, and an eyedropper tool to sample colors from anywhere in the application window. The panel maintains a pending color that is only committed when the user clicks OK, allowing for non-destructive color exploration.Key Changes
New color selection modules (
src/ui/color_select/):picker.rs: MainColorPickerstate machine and UI layout with tabbed interface (Index/True Color)editor.rs: Reusable color editor with HSB/RGB sliders, saturation/brightness field, and hex inputeyedropper.rs: Full-window screenshot-based color sampling tool with magnifier previewmath.rs: Pure color math functions (HSB↔RGB conversion, hex parsing, ACI lookup, color formatting)widgets/color_area.rs: Custom interactive saturation/brightness gradient field widgetInterface color picker integration: Options dialog now uses the Select Color panel for editing UI colors (backgrounds, text, etc.) instead of the basic
iced_awpickerKeyboard navigation:
Updated app state:
color_pick_targetandcolor_picker_tabwith unifiedcolor_picker: Option<ColorPicker>bg_pickerfield (background color picker state)color_pickerfield to track active color selection sessionLocalization: Removed obsolete locale strings for "no recent colors" and "true color RGB" labels
Notable Implementation Details
#RRGGBBand#RGBformats, applying 6-digit values while typing and 3-digit values on Enterhttps://claude.ai/code/session_013rGmDUNr1hUf4zo1X3dak8