Skip to content

feat(table): paint columns by style and rules - #24

Merged
dgrieser merged 1 commit into
mainfrom
feat/table-column-styles
Nov 27, 2026
Merged

dgrieser merged 1 commit into
mainfrom
feat/table-column-styles

Conversation

@dgrieser

Copy link
Copy Markdown
Collaborator

Moves the generic table painting of api-kit into cli-kit, so api-kit only maps its definition onto it.

  • table.WithColumnStyles(...table.ColumnStyle) paints the cells of each column of a painted table, line by line: Style for cells that carry no colors of their own (a cell the program painted, such as a fresh age, keeps its colors), then Rules on every cell. Links in a cell stay. Markdown and records are never painted.
  • table.Palette and table.NewPalette(getenv, prefix) hold the colors of a listing, changed through <prefix>_COLOR_TABLE_HEADER, _COLOR_TABLE_COLUMN_1…_6, _TEXT_COLOR_DURATION and _TEXT_DURATION_FRESH.
  • theme.Rules paints text with whole-text and pattern rules in turn; a whole-text rule takes out earlier colors but keeps links. theme.HasColor tells painted text from plain.
  • format.Ago words an age ("5 minutes ago", "3 hours from now"); format.ParseTimestamp reads RFC 3339 timestamps with seconds and a zone, offsets checked for range.

🤖 Generated with Claude Code

Add what api-kit painted itself to the packages it uses:

- table.WithColumnStyles paints the cells of each column of a painted
  table, line by line: a style for cells the program did not paint, and
  theme.Rules on every cell. Links in a cell stay.
- table.Palette and table.NewPalette hold the colors of a listing,
  changed through <prefix>_COLOR_TABLE_* environment variables.
- theme.Rules paints text with a sequence of whole-text and pattern
  rules; theme.HasColor tells painted text from plain.
- format.Ago words an age ("5 minutes ago", "3 hours from now"), and
  format.ParseTimestamp reads a point in time as APIs write it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dgrieser
dgrieser merged commit efdd5d2 into main Nov 27, 2026
14 checks passed
@dgrieser
dgrieser deleted the feat/table-column-styles branch November 27, 2026 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant