From 8f4336f1f60e66fffdf1bd3a6cf3e9d392ec04f9 Mon Sep 17 00:00:00 2001 From: "R.Eugenio" Date: Mon, 29 Dec 2025 21:30:11 +0100 Subject: [PATCH] =?UTF-8?q?feat(widgets):=20Z-Design=20usar=20theme=20din?= =?UTF-8?q?=C3=A1mico=20en=20todos=20los=20widgets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cambio de Style.Theme.dark (hardcoded) a Style.currentTheme().* en 5 archivos / 7 ocurrencias: - text_input.zig (línea 282) - button.zig (líneas 75, 163) - list.zig (líneas 124, 131) - checkbox.zig (línea 61) - select.zig (línea 102) Ahora todos los widgets usan el ThemeManager global, permitiendo cambio de tema en runtime. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/widgets/button.zig | 8 ++++---- src/widgets/checkbox.zig | 4 ++-- src/widgets/list.zig | 5 +++-- src/widgets/select.zig | 3 ++- src/widgets/text_input.zig | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/widgets/button.zig b/src/widgets/button.zig index a3ab270..bde519c 100644 --- a/src/widgets/button.zig +++ b/src/widgets/button.zig @@ -71,8 +71,8 @@ pub fn buttonRect(ctx: *Context, bounds: Layout.Rect, text: []const u8, config: const pressed = hovered and ctx.input.mouseDown(.left); const clicked = hovered and ctx.input.mouseReleased(.left); - // Determine colors based on state - const theme = Style.Theme.dark; + // Determine colors based on state (Z-Design: usar theme dinámico) + const theme = Style.currentTheme().*; const base_bg = config.bg orelse switch (config.importance) { .normal => theme.button_bg, @@ -159,8 +159,8 @@ pub fn buttonStatefulRect( // Update transition animation state.transition.updateWithPress(hovered, pressed, dt_ms); - // Determine colors based on animated state - const theme = Style.Theme.dark; + // Determine colors based on animated state (Z-Design: usar theme dinámico) + const theme = Style.currentTheme().*; const base_bg = config.bg orelse switch (config.importance) { .normal => theme.button_bg, diff --git a/src/widgets/checkbox.zig b/src/widgets/checkbox.zig index 81fcd03..523c000 100644 --- a/src/widgets/checkbox.zig +++ b/src/widgets/checkbox.zig @@ -57,8 +57,8 @@ pub fn checkboxRect( changed = true; } - // Theme colors - const theme = Style.Theme.dark; + // Theme colors (Z-Design: usar theme dinámico) + const theme = Style.currentTheme().*; // Calculate box position (vertically centered) const box_y = bounds.y + @as(i32, @intCast((bounds.h -| config.box_size) / 2)); diff --git a/src/widgets/list.zig b/src/widgets/list.zig index 15ed457..d50e51c 100644 --- a/src/widgets/list.zig +++ b/src/widgets/list.zig @@ -121,14 +121,15 @@ pub fn listRect( if (items.len == 0) { // Draw empty list if (config.show_border) { - const theme = Style.Theme.dark; + const theme = Style.currentTheme().*; ctx.pushCommand(Command.rect(bounds.x, bounds.y, bounds.w, bounds.h, theme.background)); ctx.pushCommand(Command.rectOutline(bounds.x, bounds.y, bounds.w, bounds.h, theme.border)); } return result; } - const theme = Style.Theme.dark; + // Z-Design: usar theme dinámico + const theme = Style.currentTheme().*; const mouse = ctx.input.mousePos(); const list_hovered = bounds.contains(mouse.x, mouse.y); diff --git a/src/widgets/select.zig b/src/widgets/select.zig index bccb94b..f798373 100644 --- a/src/widgets/select.zig +++ b/src/widgets/select.zig @@ -99,7 +99,8 @@ pub fn selectRect( // Register as focusable in the active focus group ctx.registerFocusable(widget_id); - const theme = Style.Theme.dark; + // Z-Design: usar theme dinámico + const theme = Style.currentTheme().*; // Check mouse interaction on main button const mouse = ctx.input.mousePos(); diff --git a/src/widgets/text_input.zig b/src/widgets/text_input.zig index bcad615..e8740b3 100644 --- a/src/widgets/text_input.zig +++ b/src/widgets/text_input.zig @@ -278,8 +278,8 @@ pub fn textInputRect( // Sync state.focused for backwards compatibility state.focused = has_focus; - // Theme colors - const theme = Style.Theme.dark; + // Theme colors (Z-Design: usar theme dinámico) + const theme = Style.currentTheme().*; const bg_color = if (has_focus) theme.input_bg.lighten(5) else theme.input_bg; // Use override colors if provided, otherwise use theme defaults const border_color = config.border_color orelse (if (has_focus) theme.primary else theme.input_border);