Skip to content

[plan] Enhance table rendering with conditional styling and responsive widths #14021

@github-actions

Description

@github-actions

Objective

Improve table rendering throughout the codebase by adding conditional cell styling, responsive column widths, and improved visual feedback for status information.

Context

Issue #14013 identified opportunities to leverage advanced lipgloss/table features. Current tables use basic zebra striping but could benefit from status-based coloring and intelligent column sizing.

Approach

  1. Add conditional cell styling based on content (status colors)
  2. Implement responsive column width management
  3. Update pkg/console/console.go table rendering functions
  4. Apply enhancements to key commands: status, logs, audit

Implementation Details

Conditional Cell Styling

styleFunc := func(row, col int) lipgloss.Style {
    // Status-based coloring for specific columns
    if col == statusColumn {
        cellValue := allRows[row][col]
        if cellValue == "failed" {
            return lipgloss.NewStyle().
                Foreground(styles.ColorError).
                Bold(true)
        } else if cellValue == "success" {
            return lipgloss.NewStyle().
                Foreground(styles.ColorSuccess)
        }
    }
    
    // Zebra striping for other cells
    if row%2 == 0 {
        return styles.TableCell.PaddingLeft(1).PaddingRight(1)
    }
    return lipgloss.NewStyle().
        Foreground(styles.ColorForeground).
        Background(styles.ColorTableAltRow).
        PaddingLeft(1).PaddingRight(1)
}

Responsive Width Management

t := table.New().
    Headers(config.Headers...).
    Rows(config.Rows...).
    Border(styles.RoundedBorder).
    BorderStyle(styles.TableBorder).
    StyleFunc(styleFunc).
    Width(getTerminalWidth()).
    MaxWidth(120)

Files to Modify

  • Update: pkg/console/console.go - Enhance table rendering functions
  • Update: pkg/cli/status.go - Apply conditional styling for workflow status
  • Update: pkg/cli/logs.go - Apply conditional styling for log entries
  • Update: pkg/cli/audit.go - Apply conditional styling for audit results
  • Update: pkg/console/console_test.go - Add tests for conditional styling

Acceptance Criteria

  • Status values (success, failed, pending) have distinct colors
  • Tables adjust width based on terminal size
  • Column widths are intelligently distributed
  • MaxWidth prevents tables from being too wide
  • Zebra striping remains for non-status columns
  • Accessibility mode disables fancy styling
  • Tests validate conditional styling logic
  • Tables remain readable in narrow terminals (80 columns)
    Related to Terminal Stylist Analysis: Console Output Patterns in gh-aw #14013

AI generated by Plan Command for #14013

  • expires on Feb 8, 2026, 1:01 AM UTC

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions