diff --git a/src/widgets/advanced_table/advanced_table.zig b/src/widgets/advanced_table/advanced_table.zig index 831fa2d..736a90a 100644 --- a/src/widgets/advanced_table/advanced_table.zig +++ b/src/widgets/advanced_table/advanced_table.zig @@ -143,7 +143,7 @@ pub fn advancedTableRect( config.row_height, ); - drawRow(ctx, row_bounds, table_state, table_schema, row_idx, state_col_w, colors, &result); + drawRow(ctx, row_bounds, table_state, table_schema, row_idx, state_col_w, colors, has_focus, &result); } // End clipping @@ -354,6 +354,7 @@ fn drawRow( row_idx: usize, state_col_w: u32, colors: *const TableColors, + has_focus: bool, result: *AdvancedTableResult, ) void { const config = table_schema.config; @@ -375,9 +376,10 @@ fn drawRow( .normal => row_bg, }; - // Selection overlay + // Selection overlay - color depende de si la tabla tiene focus if (is_selected_row) { - row_bg = blendColor(row_bg, colors.selected_row, 0.4); + const selection_color = if (has_focus) colors.selected_row else colors.selected_row_unfocus; + row_bg = blendColor(row_bg, selection_color, 0.5); } // Draw row background diff --git a/src/widgets/advanced_table/types.zig b/src/widgets/advanced_table/types.zig index 3191255..c5f1c2b 100644 --- a/src/widgets/advanced_table/types.zig +++ b/src/widgets/advanced_table/types.zig @@ -219,6 +219,10 @@ pub const BasicColors = struct { header_bg: ?Style.Color = null, row_alternate: ?Style.Color = null, border: ?Style.Color = null, + /// Color de fila seleccionada cuando tiene focus + selected_row: ?Style.Color = null, + /// Color de fila seleccionada cuando NO tiene focus + selected_row_unfocus: ?Style.Color = null, /// Convierte cualquier tipo con campos r,g,b (y opcionalmente a) a Style.Color. /// Útil para convertir desde otros tipos Color (ej: zcatconfig.Color). @@ -257,6 +261,7 @@ pub const TableColors = struct { // Selection selected_cell: Style.Color = Style.Color.rgb(66, 135, 245), selected_row: Style.Color = Style.Color.rgb(50, 80, 120), + selected_row_unfocus: Style.Color = Style.Color.rgb(60, 60, 70), // State colors state_modified: Style.Color = Style.Color.rgb(255, 255, 100), // Yellow @@ -318,9 +323,10 @@ pub const TableColors = struct { .row_alternate = opts.row_alternate orelse (if (is_dark) bg.lighten(5) else bg.darken(3)), .row_hover = if (is_dark) bg.lighten(15) else bg.darken(8), - // Selection - basada en acento + // Selection - basada en acento (o valores explícitos) .selected_cell = accent, - .selected_row = accent.darken(30), + .selected_row = opts.selected_row orelse accent.darken(30), + .selected_row_unfocus = opts.selected_row_unfocus orelse (if (is_dark) bg.lighten(25) else bg.darken(15)), // States - colores estándar universales .state_modified = Style.Color.rgb(255, 255, 100),