git.lucas.co / cce-designer
graphic design tool
git clone https://git.lucas.co/cce-designer.git

commit208b2e8209b5f4d19e917d3e10a42c9031801ab1
parentf4404ab63e
authorLucas Galante <[email protected]>
date2026-07-24 14:45
feat: Plate Color — Style section retints the params plate live

An rgba param (alpha = frost strength) seeded from the live cce-ui
color; edits stream through the picker and apply via
set_param_bg_color while it is open (tick-driven sync of the pane's
live-streaming widgets).

Co-Authored-By: Claude Fable 5 <[email protected]>

 src/app.rs     | 10 ++++++++++
 src/project.rs | 28 ++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/app.rs b/src/app.rs
index 9c2cd20..256fe4f 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -4751,12 +4751,22 @@ pub(crate) fn geometry_to_spreadsheet_data(geom: &Geometry) -> (Vec<String>, Vec
         }
 
         let mut tick_changed = false;
+        let mut param_ticked = false;
         let ctx = &mut self.ui_context;
         for i in 0..WIDGET_COUNT {
             if self.slots.get_dyn_mut(i).tick(dt, ctx) {
                 tick_changed = true;
+                if i == PARAM_IDX {
+                    param_ticked = true;
+                }
             }
         }
+        // Live-streaming param widgets (the color picker's --stream lines)
+        // change row values inside tick — push them through the same sync the
+        // input path uses so they apply while the picker stays open.
+        if param_ticked {
+            self.sync_parameters_to_project();
+        }
         if cce_ui::widget::hover_animation::tick(dt) {
             tick_changed = true;
         }
diff --git a/src/project.rs b/src/project.rs
index 4ac6c8d..e35389b 100644
--- a/src/project.rs
+++ b/src/project.rs
@@ -423,6 +423,20 @@ impl State {
         // untouched identity spec means "analytic quadrant" (apply below
         // clears the profile for it) and any edited curve takes over.
         ensure_param(main_node, "Edge Profile", "ramp", "smooth;0.000:0.000,1.000:1.000", &[], None, None, None);
+        // The params plate's tint, rgba — alpha doubles as the frost strength
+        // under plate blur. Seeded from the live cce-ui color (linear → sRGB
+        // for the hex; alpha is stored linear on both sides).
+        let plate_hex = {
+            let c = cce_ui::color::param_bg_color();
+            format!(
+                "#{:02x}{:02x}{:02x}{:02x}",
+                (cce_ui::color::linear_to_srgb(c[0]) * 255.0).round().clamp(0.0, 255.0) as u8,
+                (cce_ui::color::linear_to_srgb(c[1]) * 255.0).round().clamp(0.0, 255.0) as u8,
+                (cce_ui::color::linear_to_srgb(c[2]) * 255.0).round().clamp(0.0, 255.0) as u8,
+                (c[3] * 255.0).round().clamp(0.0, 255.0) as u8,
+            )
+        };
+        ensure_param(main_node, "Plate Color", "rgba", &plate_hex, &[], None, None, None);
 
         // The Help section is retired — its only row was an About button nothing
         // dispatched. Drop it from older saves too.
@@ -460,7 +474,7 @@ impl State {
             }
         }
 
-        const MAIN_PARAM_ORDER: [&str; 35] = [
+        const MAIN_PARAM_ORDER: [&str; 36] = [
             "File", "New Project", "Open", "Save", "Save As", "Exit",
             "Edit", "Undo", "Redo",
             "View", "Show Viewport Pane", "Show Parameters Pane",
@@ -471,7 +485,7 @@ impl State {
             "Show Grid Guide", "Show Reference Cube", "Show Origin Axes",
             "Ray Traced Preview", "Grid Thickness", "Origin Guide Size",
             "Camera Pivot Size", "Background Color", "Grid Color",
-            "Style", "Bevel Profile", "Edge Profile",
+            "Style", "Bevel Profile", "Edge Profile", "Plate Color",
         ];
         main_node.params.sort_by_key(|p| {
             MAIN_PARAM_ORDER
@@ -608,6 +622,16 @@ impl State {
                             cce_ui::layout::clear_roll_profile();
                         }
                     }
+                    "Plate Color" => {
+                        if let Some(c) = cce_ui::color::parse_hex_bytes(&p.default) {
+                            cce_ui::color::set_param_bg_color([
+                                cce_ui::color::srgb_to_linear(c[0] as f32 / 255.0),
+                                cce_ui::color::srgb_to_linear(c[1] as f32 / 255.0),
+                                cce_ui::color::srgb_to_linear(c[2] as f32 / 255.0),
+                                c[3] as f32 / 255.0,
+                            ]);
+                        }
+                    }
                     _ => {}
                 }
             }