git.lucas.co / cce-ui
GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git

commit4b31f81f4d0c844c06e419eb58474b8fed28a254
parent061438963f
authorLucas Galante <lsgalante12@gmail.com>
date2026-09-29 17:44
refactor: retire the graph's uniform_background

It chose the cell fill, which is gone, so it chose nothing. The field and
set_uniform_background are removed, and style.surface.graph.uniform_background
is reported with the other retired keys.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

 src/color.rs                | 12 +++++++-----
 src/widget/display/graph.rs | 19 ++++++-------------
 tests/lattice_probe.rs      |  2 --
 3 files changed, 13 insertions(+), 20 deletions(-)

diff --git a/src/color.rs b/src/color.rs
index 9feb8cf..6e5ea87 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -780,9 +780,10 @@ fn parse_and_set_colors(content: &str) {
 /// / `bevel_width` / `bevel_shader`, the block the relief keys were born in
 /// before `style.surface.relief` existed (the compositor never read them;
 /// the shader toggle is `relief.shader` now). Each was an alias for part
-/// of 2026-09-28 and is not read now. And the graph's `cell_color` and
-/// `gap_color` (2026-09-29): a graph's cells have no colour, and its lines
-/// are `graph.grid_color`. Empty for a clean config.
+/// of 2026-09-28 and is not read now. And the graph's `cell_color`,
+/// `gap_color` and `uniform_background` (2026-09-29): a graph's cells have
+/// no colour, so there is no fill to switch, and its lines are
+/// `graph.grid_color`. Empty for a clean config.
 pub fn retired_surface_keys(val: &serde_json::Value) -> Vec<String> {
     let mut found = Vec::new();
     for k in ["blur", "radius", "backdrop_compression", "refraction", "bevel_width"] {
@@ -813,7 +814,7 @@ pub fn retired_surface_keys(val: &serde_json::Value) -> Vec<String> {
             }
         }
     }
-    for k in ["cell_color", "gap_color"] {
+    for k in ["cell_color", "gap_color", "uniform_background"] {
         if val.pointer(&format!("/style/surface/graph/{k}")).is_some() {
             found.push(format!("style.surface.graph.{k}"));
         }
@@ -2274,7 +2275,7 @@ mod tests {
             "material": { "glass": { "frost": { "backdrop_compression": 0.6 }, "finish": { "depth": 0.2 } } }
         } }, "window_manager": { "bevel_depth": 0.15, "bevel_width": 9.3, "bevel_shader": 0 } });
         let mut old = old;
-        old["style"]["surface"]["graph"] = serde_json::json!({ "cell_color": "#545467", "gap_color": "#48485b", "grid_color": "#48485b" });
+        old["style"]["surface"]["graph"] = serde_json::json!({ "cell_color": "#545467", "gap_color": "#48485b", "grid_color": "#48485b", "uniform_background": false });
         assert_eq!(retired_surface_keys(&old), vec![
             "style.surface.plate.blur",
             "style.surface.plate.radius",
@@ -2294,6 +2295,7 @@ mod tests {
             "style.surface.material.glass.finish.depth",
             "style.surface.graph.cell_color",
             "style.surface.graph.gap_color",
+            "style.surface.graph.uniform_background",
         ]);
         assert!(retired_surface_keys(&serde_json::json!({})).is_empty());
     }
diff --git a/src/widget/display/graph.rs b/src/widget/display/graph.rs
index c1b901f..861b574 100644
--- a/src/widget/display/graph.rs
+++ b/src/widget/display/graph.rs
@@ -101,7 +101,6 @@ pub struct Graph {
     // Hover tracking
     toggle_hovered_idx: Option<usize>,
 
-    uniform_background: bool,
     network_opacity: f32,
     /// Node-domain opacity (bodies, wires, connectors) — independent of
     /// `network_opacity`, which fades the pane surface (grid cells/gaps).
@@ -161,7 +160,6 @@ impl Graph {
             drag_oy: 0.0,
             drag_node_pos: None,
             toggle_hovered_idx: None,
-            uniform_background: false,
             network_opacity: crate::color::graph_opacity(),
             node_opacity: crate::color::graph_node_opacity(),
             grid_color: grid_col,
@@ -174,9 +172,6 @@ impl Graph {
         })
     }
 
-    pub fn set_uniform_background(&mut self, uniform: bool) {
-        self.uniform_background = uniform;
-    }
     pub fn set_network_opacity(&mut self, opacity: f32) {
         self.network_opacity = opacity;
     }
@@ -376,9 +371,9 @@ impl Graph {
     /// near-transparent black, so the cells between the grid lines are
     /// whatever the graph is painted on, and under `graph_blur` a frosted
     /// material whose tint alpha IS the blur value — the knob doubles as
-    /// the frost's opacity. Until 2026-09-29 a `uniform_background` graph
-    /// filled itself with a cell colour of its own (`graph.cell_color`);
-    /// the flag is kept for the hosts that set it and chooses nothing here.
+    /// the frost's opacity. Until 2026-09-29 a graph could fill itself
+    /// with a cell colour of its own (`graph.cell_color`, chosen by
+    /// `uniform_background`); both went together.
     fn bg_color(&self) -> [f32; 4] {
         use crate::scene::{Frost, Material, PlateRole};
         let c = [0.0, 0.0, 0.0, 0.01 * self.network_opacity];
@@ -397,7 +392,7 @@ impl Graph {
     pub fn cell_corner_radius(&self) -> f32 {
         // Pure GEOMETRY — no display gating: the cursor and the highlight
         // exist whether or not the lattice is drawn. Gating on
-        // show_network_grid/uniform_background silently squared those
+        // show_network_grid silently squared those
         // consumers whenever the grid was hidden.
         if self.node_w <= 0.0 || self.node_h <= 0.0 {
             return 0.0;
@@ -414,10 +409,8 @@ impl Graph {
     /// measured centre to centre, and `graph_line_width` only thickens
     /// them), so the intersections are exactly where the node centres go.
     /// Plus the origin axes: the two lines through the (0, 0) intersection,
-    /// 2px, in the axis colour. Gated on the grid's visibility only:
-    /// `uniform_background` describes the widget's own background fill and
-    /// the designer hard-codes it true, which is how its grid went undrawn
-    /// until 2026-09-20. (Rounded cells with grout between them came before
+    /// 2px, in the axis colour. Gated on the grid's visibility only.
+    /// (Rounded cells with grout between them came before
     /// the lattice; a node then FILLED a cell rather than sitting on a
     /// crossing.)
     pub fn paint_grid(&self, rect: Rect, pc: &mut PaintCtx) {
diff --git a/tests/lattice_probe.rs b/tests/lattice_probe.rs
index ab643b2..e7af4a9 100644
--- a/tests/lattice_probe.rs
+++ b/tests/lattice_probe.rs
@@ -36,8 +36,6 @@ fn graph_paints_its_lattice_as_lines_and_axes() {
     g.set_grid_origin(50.0, 50.0);
     g.set_network_opacity(1.0);
     g.set_show_network_grid(true);
-    // The designer hard-codes a uniform background; that must not hide the grid.
-    g.set_uniform_background(true);
     let mut pc = PaintCtx::new();
     let rect = Rect { x: 40.0, y: 40.0, width: 600.0, height: 300.0 };
     g.paint_grid(rect, &mut pc);