From 7097741460d683b4ddf1ba78026e7759f2d5ee21 Mon Sep 17 00:00:00 2001 From: Martin Ball <98639962+benandez@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:24:35 +0000 Subject: [PATCH] fix(color-ui): Colors dialog: Colors heading, and a no-colour Current half (storytold/wordcraft#7984) (#4093) The tabbed dialog's Standard and Custom pages get the Colors: heading. ColorPickerDialog::no_current opens on a colour while the compare block's current half draws the "no colour" diagonal (WellFill::None, not the mixed mark) and is not a restore button (CompareSwatch::no_current, ColorPicker::compare_none). Reset still returns to the given colour. Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx Co-authored-by: Claude Opus 5.5 --- crates/color-ui/src/ui/compare.rs | 34 +++++++++++++--- crates/color-ui/src/ui/picker/compact.rs | 2 + crates/color-ui/src/ui/picker/full.rs | 5 ++- crates/color-ui/src/ui/picker/mod.rs | 7 ++++ crates/color-ui/src/ui/picker_dialog.rs | 52 ++++++++++++++++++++++-- crates/color-ui/tests/it/picker.rs | 28 +++++++++++++ 6 files changed, 117 insertions(+), 11 deletions(-) diff --git a/crates/color-ui/src/ui/compare.rs b/crates/color-ui/src/ui/compare.rs index d45e75509f..ccd4720c5a 100644 --- a/crates/color-ui/src/ui/compare.rs +++ b/crates/color-ui/src/ui/compare.rs @@ -4,7 +4,7 @@ use craft_behavior::{Metrics, Mixed, PartKey, Sense}; use craft_theme::Srgba; use craft_ui::contract::{Access, Common, Component, Cx, MeasureCx, Name, Outcome, PaintUi, PartsCx, Props as _, Role}; use craft_ui::display::{Shade, Text}; -use craft_ui::primitives::{PaintShape, StrokeWidth, TextRun}; +use craft_ui::primitives::{PaintShape, StrokeWidth, TextRun, WellFill}; use craft_ui::runtime::env::Label; use craft_ui::style::{ComponentStyle, FocusLook, StyleColor, StyleCx, TypeRole}; use egui::{CornerRadius, Rect, Response, Vec2, pos2}; @@ -83,6 +83,7 @@ pub struct CompareSwatch<'a> { new: Mixed, current: Mixed, warnings: &'a [ColorWarning], + no_current: bool, restore: bool, warning: Option, } @@ -90,7 +91,23 @@ pub struct CompareSwatch<'a> { impl<'a> CompareSwatch<'a> { /// A block named `label` ("New color", the new half's name) showing `new` over `current`. pub fn new(label: impl Into