Graphic Attributes: show *VARIES* on the colour swatch again

Differing colours are spelled out on the swatch again; ByLayer and ByBlock
still show only on the L / B button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VgkJN8DEojuPTumAXLHotu
This commit is contained in:
Claude committed 2026-10-07 19:24:04 +00:00
1 parent 33a105a619
commit 32ed58fe77
1 file changed
+19 -3
+19 -3
View File
@@ -700,16 +700,32 @@ fn color_control<'a>(
target: ColorPickTarget,
changed: fn(AcadColor) -> GraphicAttributesMsg,
) -> Element<'a, Message> {
// The L / B / C / V button already shows ByLayer, ByBlock and *VARIES*,
// so the swatch carries no text.
// ByLayer / ByBlock show only on the L / B button; differing colours are
// also spelled out on the swatch.
let label: Element<'a, Message> = if info.varies {
container(text("*VARIES*").size(10))
.width(Fill)
.height(Fill)
.align_x(iced::Left)
.align_y(iced::Center)
.padding([0, 6])
.into()
} else {
Space::new().width(Fill).height(Fill).into()
};
let display = info.display;
let swatch = button(Space::new().width(Fill).height(Fill))
let swatch = button(label)
.on_press(Message::OpenColorWindow(target.clone(), info.color))
.width(Fill)
.height(COMPACT_BUTTON_HEIGHT)
.padding(0)
.style(move |theme: &Theme, status| button::Style {
background: Some(Background::Color(display)),
text_color: if display.r * 0.299 + display.g * 0.587 + display.b * 0.114 > 0.55 {
iced::Color::BLACK
} else {
iced::Color::WHITE
},
border: Border {
color: if matches!(status, button::Status::Hovered) {
theme.palette().primary.base.color