Console-only color enforcement + full ANSI remap #11
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
residual/.agent#11
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Plan: Console-only color enforcement + full ANSI remap
Goal
Only
res-consoleenforces the residual amber palette. All other apps (res-sh,res-login,res-edit,res-code,res-calc,res-sheets) inherit the terminal's existing color theme.res-consoleapplies the full 16-color ANSI remap (ApplyPalette) so child processes inside the console get amber-ized. On exit, the console resets the terminal to defaults.res-themeis exempt — it is the theme editor/preview tool and manages its own OSC sequences.Relationship to existing work
This builds on issue #3 ("Unified residual theming (two-mode per-app)"), which already implemented per-app
unified_themeopt-in forres-edit,res-code,res-calc, andres-sheets. This issue completes the enforcement model by:res-shandres-loginres-consolethe sole strict enforcer with full ANSI remapUnifiedThemesemantics inres-consoleCurrent bugs
res-console/main.gohas invertedUnifiedThemelogic:true→ inherit,false→ amber. Should betrue→ amber,false→ inherit.res-consoleusesApplyConsolePalette()(fg/bg only) instead ofApplyPalette()(full 16-color remap).res-shandres-loginstill force the full palette viaApplyPalette+RES_THEME_ENFORCED.console/config/config.goDefaults()hasUnifiedThemeas Go zero value (false), but console should default to amber.docs/design/aesthetic.mdstill saysres-shandres-loginare enforcers.Implementation steps
Step 1 — Remove enforcement from res-sh
core/cmd/res-sh/main.goApplyPalette/ResetPalette/RES_THEME_ENFORCEDblock (lines 42-46).res-shruns in whatever colors the terminal already has."golang.org/x/term"import if no longer needed.Step 2 — Remove enforcement from res-login
core/cmd/res-login/main.goapplyThemeGuard()function entirely (lines 378-389).defer applyThemeGuard(...)calls:defer applyThemeGuard(t.File())()inrunLogin()defer applyThemeGuard(os.Stdout)()inrunSelect()defer applyThemeGuard(t.File())()inrunDryRun()res-loginruns in whatever colors the terminal already has.Step 3 — Fix res-console as sole enforcer
core/cmd/res-console/main.goUnifiedThemeinversion. Current code: Should be:ApplyConsolePalette()toApplyPalette()for full 16-color ANSI remap.Step 4 — Fix console config defaults
core/internal/libs/console/config/config.goUnifiedTheme: trueinDefaults():consoleTOMLTemplatecomment:Step 5 — Semantic color model for tools
res-console, the full ANSI remap converts these to amber tones.core/internal/libs/shell/remnant/prompt.go— prompt stylingcore/lib/edit/— editor syntax highlightingextra/internal/code/— IDE chromelipgloss.Color("#ffb000")ortheme.LAmberusage in toolsStep 6 — Transparent background by default
theme.DefaultConfig()already hasTransparentBg: true.ApplyPalette()andApplyConsolePalette()emit\x1b]111\x1b\\(reset background) instead of\x1b]11;<hex>\x1b\\whenactiveTransparentBgis true.palette.golines 96-98 and 113-115.Step 7 — Update docs
docs/design/aesthetic.mdres-consoleenforces.unified_themeexception description (lines 170-172):true= amber,false= inherit.docs/console/console-design.mddocs/README.mdStep 8 — Verification
cd core && go build ./... && CGO_ENABLED=1 go test ./...cd extra && go build ./... && go test ./...res-consolestarts with amber palette, childls --color=autoshows amber tones, exit restores terminal colors.res-shstandalone does NOT change terminal colors.res-logindoes NOT change terminal colors.res-edit/res-codeinside console show amber chrome when console has unified theme.res-themepreview works independently of console enforcement.Risks
ResetPalette()uses OSC 104 which not all terminals support. Terminals without OSC 104 support will retain the amber palette after console exit. This is a known limitation; document it indocs/console/console-design.md.res-themeis exempt from this rule (it's the theme editor/preview tool). It already manages its own OSC sequences.res-calc/res-sheetsfrom always-amber to inherit-by-default (from issue #3) may surprise users who expected amber. Document in release notes.Open questions
res-shprompt use ANSI colors (green for success indicator, etc.) instead of hardcoded amber lipgloss styles? (Part of Step 5 — semantic color model.)