Skip to content

feat: themeable colors (cga/green/amber)#40

Open
peczenyj wants to merge 1 commit into
feature/nolint-respectfrom
feature/themes
Open

feat: themeable colors (cga/green/amber)#40
peczenyj wants to merge 1 commit into
feature/nolint-respectfrom
feature/themes

Conversation

@peczenyj
Copy link
Copy Markdown
Owner

Adds selectable color themes, built on a small refactor of ui's hardcoded ANSI constants into a Theme over semantic roles (Header, Added, Removed, Meta, Padding, Label).

  • default reproduces today's palette byte-for-byte — all golden fixtures pass unchanged (the refactor is a no-op for existing output).
  • Built-in themes: cga (bright 16-color), green and amber (single-hue phosphor-monitor emulations; add/removed distinguished by intensity + the +/- prefixes, not hue).
  • Selection: hidden easter-egg flags -cga/-green/-amber (stripped before parsing, so invisible in -help and never trip "flag not defined") take precedence over the documented STRUCTALIGN_THEME env var, else default. Unknown name warns and falls back.
  • Orthogonal to -color: the theme only chooses which colors are used when color is on.

Verified each theme emits distinct ANSI (default 31/32/36, cga 91/92/96, green monochrome 32 + dim/bold, no red).

Not a full theming system — a fixed set of built-ins and two ways to pick one (per-role overrides / custom themes are a deferred v0.8.0 feature).

Tests: internal/ui (default matches legacy constants, ThemeByName, green-is-monochrome) + internal/app (egg accepted/stripped, unknown env warns, eggs absent from usage). task ci green (110 tests).

⚠️ Stacked (base feature/nolint-respect) during the GitHub Actions incident; base retargets to devel as the stack merges. This is the last v0.6.0 PR.

Closes #33

🤖 Generated with Claude Code

Route ui's hardcoded ANSI constants through a Theme over semantic roles
(Header/Added/Removed/Meta/Padding/Label); the default theme reproduces the
historical palette byte-for-byte, so golden output is unchanged. Add built-in
retro themes: cga (bright 16-color), green and amber (single-hue phosphor
emulations distinguished by intensity + the +/- prefixes).

Selection: hidden easter-egg flags -cga/-green/-amber (stripped pre-parse, so
invisible in -help) take precedence over the documented STRUCTALIGN_THEME env
var, else default. Unknown theme warns and falls back. Theme is orthogonal to
-color: it only chooses which colors are used when color is on.

Not a full theming system: a fixed set of built-ins and two ways to pick one.

Closes #33

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@peczenyj peczenyj self-assigned this May 26, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.88525% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (feature/nolint-respect@5e04c32). Learn more about missing BASE report.

Files with missing lines Patch % Lines
internal/app/app.go 78.57% 6 Missing ⚠️
internal/ui/printer.go 93.33% 2 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##             feature/nolint-respect      #40   +/-   ##
=========================================================
  Coverage                          ?   86.35%           
=========================================================
  Files                             ?       12           
  Lines                             ?      843           
  Branches                          ?        0           
=========================================================
  Hits                              ?      728           
  Misses                            ?       74           
  Partials                          ?       41           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants