feat(AdvancedTable): Color selección según focus del panel

Cambios:
- Añadir selected_row_unfocus a TableColors
- drawRow ahora recibe has_focus para elegir color
- Con focus: usa selected_row (color accent)
- Sin focus: usa selected_row_unfocus (gris sutil)

BasicColors ahora acepta selected_row y selected_row_unfocus
opcionales para permitir override desde PanelColorScheme.

Esto permite que el usuario vea claramente:
- Qué panel tiene focus (fila con color accent)
- Qué fila está seleccionada en panel sin focus (gris)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
reugenio 2025-12-18 23:04:11 +01:00
parent 3c52d2aa0e
commit ab63d5a7f8
2 changed files with 13 additions and 5 deletions

View file

@ -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

View file

@ -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),