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

commit14aa423c63702213cdf741f4c6658ab73e627bb0
parentd80178000b
authorLucas Galante <[email protected]>
date2026-07-03 17:34
feat: support style.data.list.font_color in configuration and widgets

 src/color.rs                    | 17 +++++++++++++++++
 src/layout.rs                   |  1 +
 src/widget/display/list_item.rs |  9 ++++++++-
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/color.rs b/src/color.rs
index 9f18c86..8db0dad 100644
--- a/src/color.rs
+++ b/src/color.rs
@@ -42,6 +42,7 @@ static TOGGLE_BG_COLOR: RwLock<[f32; 4]> = RwLock::new([0.18, 0.18, 0.22, 1.0]);
 static LIST_BG_COLOR: RwLock<[f32; 4]> = RwLock::new([0.08, 0.08, 0.12, 0.3]);
 static LIST_ENTRY_BG_COLOR: RwLock<[f32; 4]> = RwLock::new([1.0, 1.0, 1.0, 0.04]);
 static LIST_ENTRY_HIGHLIGHT_COLOR: RwLock<[f32; 4]> = RwLock::new([1.0, 1.0, 1.0, 0.8]);
+static LIST_FONT_COLOR: RwLock<[f32; 4]> = RwLock::new([0.80, 0.80, 0.85, 1.0]);
 static BREADCRUMB_BG_COLOR: RwLock<[f32; 4]> = RwLock::new([0.08, 0.08, 0.12, 1.0]);
 static POPOVER_BG_COLOR: RwLock<[f32; 4]> = RwLock::new([0.08, 0.08, 0.12, 1.0]);
 static PAGE_COLOR: RwLock<[f32; 4]> = RwLock::new([0.0, 0.0, 0.0, 0.0]);
@@ -332,6 +333,11 @@ fn parse_and_set_colors(content: &str) {
             *lock = c;
         }
     }
+    if let Some(c) = get_color("/style/data/list/font_color").or_else(|| get_color("/layout/list_font_color")) {
+        if let Ok(mut lock) = LIST_FONT_COLOR.write() {
+            *lock = c;
+        }
+    }
     if let Some(c) = parsed_breadcrumb_bg {
         if let Ok(mut lock) = BREADCRUMB_BG_COLOR.write() {
             *lock = [c[0], c[1], c[2], 1.0];
@@ -875,6 +881,17 @@ pub fn set_list_entry_highlight_color(color: [f32; 4]) {
     }
 }
 
+pub fn list_font_color() -> [f32; 4] {
+    load_colors_once();
+    *LIST_FONT_COLOR.read().unwrap()
+}
+
+pub fn set_list_font_color(color: [f32; 4]) {
+    if let Ok(mut lock) = LIST_FONT_COLOR.write() {
+        *lock = color;
+    }
+}
+
 pub fn breadcrumb_bg_color() -> [f32; 4] {
     load_colors_once();
     *BREADCRUMB_BG_COLOR.read().unwrap()
diff --git a/src/layout.rs b/src/layout.rs
index ce8db98..89a337e 100644
--- a/src/layout.rs
+++ b/src/layout.rs
@@ -64,6 +64,7 @@ fn flatten_json_to_flat_props(val: &serde_json::Value, prefix: &str, flat_props:
         _ => {
             let flat_key = match prefix {
                 "style.list.font" | "style.data.list.font" => "list_font",
+                "style.list.font_color" | "style.data.list.font_color" => "list_font_color",
                 "style.control.breadcrumb.font" => "breadcrumb_font",
                 "style.control.breadcrumb.corner_radius" => "breadcrumb_corner_radius",
                 "style.control.button.font" => "button_font",
diff --git a/src/widget/display/list_item.rs b/src/widget/display/list_item.rs
index 290620d..00a0998 100644
--- a/src/widget/display/list_item.rs
+++ b/src/widget/display/list_item.rs
@@ -136,12 +136,19 @@ impl Element for InteractiveListItem {
             crate::layout::align_text_y(y, h, 12.0, 0.0)
         };
 
+        let font_col = colors::list_font_color();
+        let title_col = [
+            (font_col[0] * 255.0) as u8,
+            (font_col[1] * 255.0) as u8,
+            (font_col[2] * 255.0) as u8,
+        ];
+
         labels.push(TextLabel {
             text: self.title.clone(),
             x: x + 8.0,
             y: title_y,
             font_size: 12.0,
-            color: [220, 220, 230],
+            color: title_col,
         });
 
         if let Some(ref sub) = self.subtitle {