From 9bafed916f4507ae681a22bbcca4c610e92cd966 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 21 Nov 2026 08:35:35 +0000 Subject: [PATCH 1/4] Info panel: two aligned halves per block, % after CMYK, rules between blocks --- crates/color-ui/src/ui/info.rs | 108 +++++++++++++++-------------- crates/color-ui/tests/it/panels.rs | 24 +++++++ 2 files changed, 81 insertions(+), 51 deletions(-) diff --git a/crates/color-ui/src/ui/info.rs b/crates/color-ui/src/ui/info.rs index fb0486c6e..d9d37d124 100644 --- a/crates/color-ui/src/ui/info.rs +++ b/crates/color-ui/src/ui/info.rs @@ -4,8 +4,10 @@ use craft_behavior::ColumnWidth; use craft_cms::convert::CmykConverter; use craft_theme::Srgba; use craft_theme::variant::Tone; -use craft_ui::contract::{Outcome as _, Pattern, Props as _, Show as _, ShowContainer as _}; -use craft_ui::display::Text; +use craft_ui::contract::{Gap, Outcome as _, Pattern, Props as _, Show as _, ShowContainer as _}; +use craft_ui::display::{Divider, Text}; +use craft_ui::form::{Field, FieldGroup}; +use craft_ui::layout::{CellAlign, GridFit}; use craft_ui::layout_components::{Grid, Stack}; use craft_ui::notices::{Notice, NoticeLayout}; use craft_ui::runtime::env::{Env, Label}; @@ -19,9 +21,8 @@ pub(crate) mod stories; /// What a missing value shows. const DASH: &str = "–"; -/// The grid's columns: a name and its value, twice, so that the two readouts of a line stand side by side and each -/// column lines up down the grid. -const COLUMNS: [ColumnWidth; 4] = [ColumnWidth::Content, ColumnWidth::Content, ColumnWidth::Content, ColumnWidth::Content]; +/// A block's two halves, equal in width. +const HALVES: [ColumnWidth; 2] = [ColumnWidth::fill(1.0), ColumnWidth::fill(1.0)]; craft_ui::words! { /// The words of the Info panel, in the installed language unless set. @@ -179,9 +180,10 @@ impl<'a> InfoReadings<'a> { } } -/// A read-only grid: RGB beside CMYK, the Ruler tool's measure (the angle A beside the length L, or a protractor's arms -/// L1 and L2 stacked beside it), X/Y beside W/H, the document size, then one row group per sampler; a dash for a -/// missing value; `document: None` shows "No document" as a centred notice in place of the grid. +/// A read-only panel of blocks, a rule between them, each block two equal halves of labelled readouts: RGB beside CMYK +/// (in percent), the Ruler tool's measure (the angle A beside the length L, or a protractor's arms L1 and L2 stacked +/// beside it), X/Y beside W/H, the document size, then a position block and a colour block per sampler; a dash for a +/// missing value; `document: None` shows "No document" as a centred notice in place of the blocks. #[must_use = "show the panel with `show`"] #[derive(Pattern)] pub struct InfoPanel<'a> { @@ -192,43 +194,38 @@ pub struct InfoPanel<'a> { /// A name and its value, or `None` for a dash. type Cell = (Label, Option