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

commit6c149eae879d5e7e69b33d6d86a67b7c54a5ed72
parenta8b10dfdb1
authorLucas Galante <[email protected]>
date2026-07-04 16:20
Support configurable plate color and border styles in config.kdl

 src/color.rs                  | 55 +++++++++++++++++++++++++++++++++++++++++++
 src/layout.rs                 |  3 +++
 src/widget/container/plate.rs |  8 ++++++-
 3 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/src/color.rs b/src/color.rs
index a20f817..3b773e2 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -458,6 +458,15 @@ fn parse_and_set_colors(content: &str) {
     if let Some(c) = get_color("/style/control/scrollbar/thumb_color") {
         if let Ok(mut lock) = SCROLLBAR_THUMB_COLOR.write() { *lock = c; }
     }
+    if let Some(c) = get_color("/style/surface/plate/color") {
+        if let Ok(mut lock) = PLATE_COLOR.write() { *lock = Some(c); }
+    }
+    if let Some(c) = get_color("/style/surface/plate/border_color") {
+        if let Ok(mut lock) = PLATE_BORDER_COLOR.write() { *lock = Some(c); }
+    }
+    if let Some(t) = val.pointer("/style/surface/plate/border_thickness").and_then(|v| v.as_f64()) {
+        if let Ok(mut lock) = PLATE_BORDER_THICKNESS.write() { *lock = t as f32; }
+    }
 }
 
 fn load_colors_once() {
@@ -1134,6 +1143,52 @@ pub fn set_backplate_statusbar_blur(b: bool) {
     if let Ok(mut lock) = BACKPLATE_STATUSBAR_BLUR.write() { *lock = b; }
 }
 
+static PLATE_COLOR: RwLock<Option<[f32; 4]>> = RwLock::new(Some([0.15, 0.15, 0.2, 0.95]));
+static PLATE_BORDER_COLOR: RwLock<Option<[f32; 4]>> = RwLock::new(Some([0.3, 0.3, 0.4, 1.0]));
+static PLATE_BORDER_THICKNESS: RwLock<f32> = RwLock::new(1.0);
+
+pub fn plate_color() -> Option<[f32; 4]> {
+    load_colors_once();
+    if let Ok(lock) = PLATE_COLOR.read() {
+        return *lock;
+    }
+    None
+}
+
+pub fn set_plate_color(c: Option<[f32; 4]>) {
+    if let Ok(mut lock) = PLATE_COLOR.write() {
+        *lock = c;
+    }
+}
+
+pub fn plate_border_color() -> Option<[f32; 4]> {
+    load_colors_once();
+    if let Ok(lock) = PLATE_BORDER_COLOR.read() {
+        return *lock;
+    }
+    None
+}
+
+pub fn set_plate_border_color(c: Option<[f32; 4]>) {
+    if let Ok(mut lock) = PLATE_BORDER_COLOR.write() {
+        *lock = c;
+    }
+}
+
+pub fn plate_border_thickness() -> f32 {
+    load_colors_once();
+    if let Ok(lock) = PLATE_BORDER_THICKNESS.read() {
+        return *lock;
+    }
+    1.0
+}
+
+pub fn set_plate_border_thickness(t: f32) {
+    if let Ok(mut lock) = PLATE_BORDER_THICKNESS.write() {
+        *lock = t;
+    }
+}
+
 #[cfg(test)]
 mod color_tests {
     use super::*;
diff --git a/src/layout.rs b/src/layout.rs
index ffb1a52..5b0c0ef 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -162,6 +162,9 @@ fn flatten_json_to_flat_props(val: &serde_json::Value, prefix: &str, flat_props:
                 "style.surface.graph.node.connector_highlight_color" => "graph_connector_highlight_color",
                 "style.surface.graph.node.connector_size" => "graph_connector_size",
                 "style.surface.graph.node.connector_activation_radius" => "graph_connector_activation_radius",
+                "style.surface.plate.color" => "plate_color",
+                "style.surface.plate.border_color" => "plate_border_color",
+                "style.surface.plate.border_thickness" => "plate_border_thickness",
                 
                 other => {
                     if let Some(rest) = other.strip_prefix("layout.") {
diff --git a/src/widget/container/plate.rs b/src/widget/container/plate.rs
index cca5a7c..70533e8 100644
--- a/src/widget/container/plate.rs
+++ b/src/widget/container/plate.rs
@@ -117,8 +117,12 @@ impl Element for Plate {
     fn solid_border(&self) -> Option<([f32; 4], f32)> {
         if self.selected {
             Some((colors::active_theme().primary_accent, 1.5))
+        } else if let Some(border) = self.solid_border {
+            Some(border)
+        } else if let Some(bc) = colors::plate_border_color() {
+            Some((bc, colors::plate_border_thickness()))
         } else {
-            self.solid_border
+            None
         }
     }
 
@@ -146,6 +150,8 @@ impl Element for Plate {
     fn color(&self) -> [f32; 4] {
         let mut c = if let Some(c) = self.color {
             c
+        } else if let Some(c) = colors::plate_color() {
+            c
         } else if self.dragging {
             let base = colors::page_low_color();
             [