[bug] Login dashboard text is nearly invisible on light terminal themes
Summary
Running codex-multi-auth login in Ghostty with a light theme makes the dashboard title and some saved-account rows nearly invisible. The dashboard uses pale foreground colors on the terminal's light background, even though the terminal's default foreground is dark and readable. Disabling colors or switching to the 16-color profile does not provide a satisfactory colored UI on this theme.
Reproduction
- Use Ghostty with Catppuccin Latte, or a comparable light terminal theme. For Latte, the background is
#eff1f5and the default foreground is#4c4f69. - Have saved accounts available so the dashboard includes account rows.
- Run
codex-multi-auth loginwith the default truecolor profile and no color-related environment overrides. - Inspect the βAccounts Dashboardβ title and the saved-account rows that use the ordinary pale text color.
Expected Behavior
The dashboard title, account labels, section labels, and help text should remain readable on light terminal backgrounds while retaining useful action colors, status badges, and selection highlights.
A light palette or a way to respect/configure the terminal's default text foreground would address this. Foreground text drawn directly on the terminal background should be handled separately from pale text drawn on the dashboard's dark selection and badge backgrounds.
Actual Behavior
- The dashboard title and some saved-account labels blend into the light background and are difficult to read.
- Section labels and help text also have weak contrast.
- Green action text and status badges with their own dark backgrounds are more readable, so the problem does not affect all elements equally.
Workarounds tried:
FORCE_COLOR=0 codex-multi-auth login
CODEX_TUI_COLOR_PROFILE=ansi16 codex-multi-auth login
Neither produces a satisfactory result: disabling colors loses useful styling, and the ANSI16 profile still looks poor with this light theme.
Environment
codex --version:codex-cli 0.160.0codex-multi-auth statusoutput summary: Not collected; the affected screen is the interactive login dashboard.codex-multi-auth rotation statusoutput summary: Not applicable to this rendering issue.npm ls -g codex-multi-auth:[email protected]in the active mise-managed Node installation, verified with its installation prefix.- OS: macOS 27.2, build
26B5091g - Node.js:
v25.9.0 - Terminal: Ghostty
1.3.2-main-+4ff699343(tip) - Terminal theme: Catppuccin Latte, light mode
- Dashboard color profile: Default
truecolor - Dashboard palette: Green
Diagnostic Outputs
The following source observations may help locate the cause:
- In
lib/ui/theme.ts,getColors()assignsheading: truecolor(240, 253, 244)(#f0fdf4) andmuted: truecolor(148, 163, 184)(#94a3b8). These same values are present in the installed 2.3.3 package. - In
lib/ui/select.ts, the dashboard title uses the heading color, and the default branch ofcodexColorCode()also returns that color for ordinary menu text. #f0fdf4is very close to Latte's background,#eff1f5. Because this is an explicit RGB escape sequence, changing the terminal's ANSI white palette entry does not change it.- The green and blue dashboard palettes share the same heading and muted colors. The current theme options do not provide a light-background variant.
codex-multi-auth check, report --json, and doctor --json outputs have not been collected; this report concerns interactive text rendering.
Logs (Optional)
No request logs collected for this UI issue.
Compliance Confirmation
- [x] I am using this project for personal development workflows.
- [x] This report does not request policy bypasses or prohibited usage.
- [x] I removed any secrets/tokens from this report.
Coding Plan
Summary
- add a dashboard preference
uiBackgroundModewith defaultdarkand alternativelight. follow theuiThemePreset/uiAccentColorpattern atlib/dashboard-settings.ts:131-151,293-390. keep background appearance separate from color depth. - in light mode, use terminal default fg (
\x1b[39m) forheadingatlib/ui/theme.ts:147-195. use darker shades formuted, action colors, status colors, and accent colors. keep paired focus and badge fg/bg unchanged atlib/ui/theme.ts:163-164,178-179,193-194andlib/ui/format.ts:43-111. - add the field to every explicit inventory: normalization, clone, equality,
THEME_PANEL_KEYS, runtime setter, and reset helper. otherwise, load, save, or plugin-side runtime updates can drop the preference. key integration points arelib/codex-manager/dashboard-settings-data.ts:41-42,103-104,lib/codex-manager/settings-hub/dashboard.ts:160-175, andlib/ui/runtime.ts:51-67,88. - add exact token and selector-rendering regression tests. explicitly cover the currently untested default branch at
lib/ui/select.ts:275with the tty mock attest/select.test.ts:3-38. - cover concurrent saves and windows cleanup at
test/unified-settings.test.ts:699-862. cover cancel and scoped reset attest/codex-manager-cli.test.ts:11539-11583.
Design Choices
Design Choice 1: expose light-background readability through a dashboard preference
Options Considered:
- globally change
heading/muteddefaults to values that work on both backgrounds, with no new setting. - add a persisted dashboard preference
uiBackgroundMode: "dark" | "light"(defaultdark). forward the preference to a newbackgroundtheme option. use that option to select appearance-aware foreground tokens. - auto-detect the terminal background through
COLORFGBGor an osc 11 query.
Chosen Option: 2
Rationale: option 2. it is backward compatible for dark-terminal users. it follows the existing uiThemePreset/uiAccentColor pattern. option 3 is unreliable: ghostty does not set COLORFGBG, and an osc query needs raw stdin reads that are risky on windows consoles.
Design Choice 2: use the terminal default foreground for light-mode title and ordinary text
Options Considered:
- use a fixed dark rgb, for example slate-800, for
headingin light mode. - use the terminal default foreground sgr
\x1b[39mforheadingin light mode in all profiles. use darker explicit values formuted,primary/success/border,accent,warning, anddanger.
Chosen Option: 2
Rationale: option 2. latte defines its default fg as #4c4f69, and option 2 honors that value exactly in every depth. action colors stay saturated but dark enough for light backgrounds.
Design Choice 3: keep the current token set instead of adding a separate text token
Options Considered:
- add a new
texttoken toUiThemeColorsand reroute the default branch. - keep the current token set and make
headingappearance-aware.
Chosen Option: 2
Rationale: option 2. in light mode, the title and ordinary text both need the default fg. a new token adds churn in many consumers (lib/codex-manager/commands/status.ts, lib/codex-manager/health-check.ts, index.ts) and fixes no additional symptom.
Design Choice 4: ship only the dashboard preference without an env override
Options Considered:
- add an env override, for example
CODEX_TUI_BACKGROUND, and a plugin-config field. - ship only the dashboard preference.
Chosen Option: 2
Rationale: option 2. codex-multi-auth login already loads dashboard settings at lib/codex-manager.ts:656-657, so the dashboard preference covers the reported screen. an env override can follow later without schema changes.
π‘ User Tips
Regenerate the plan with different choices with @coderabbitai <feedback>.
Implementation Steps
Phase 1: appearance-aware theme tokens
add a background dimension to theme construction and runtime state. change only foregrounds drawn directly on the terminal background. these tasks share the lib/ui/ layer and one test surface.
no light or dark concept exists today. palette and profile are separate from background brightness. the ticket asks to respect the terminal default foreground or provide a light palette. codexColorCode() falls back to heading for ordinary labels at lib/ui/select.ts:275.
Task 1: add the background option to createUiTheme()
give the theme a light variant. keep focus and badge pairs unchanged.
- at
lib/ui/theme.ts:5-8, add the exported typeUiBackground = "dark" | "light". - at
lib/ui/theme.ts:245-265, add an optionalbackgroundfield to the inline options type ofcreateUiTheme(). default todark. passbackgroundintogetColors()and accent resolution atlib/ui/theme.ts:99-134. darkmust produce byte-identical output to the current tokens. this prevents a regression for existing users.- for
light, override only background-relative foregrounds in each profile:headingβ\x1b[39m(terminal default fg) in all depths.mutedβ a mid-dark slate. examples are truecolor(71,85,105), ansi256240, and ansi1690. the value must remain readable whenlib/codex-manager/formatters/text-style.ts:8-16adds dim.primary/success/borderβ darker palette shades. for green, use truecolor green-700, ansi25628, and ansi1632. for blue, use blue-700, ansi25626, and ansi1634.- each
accentvalue β its darker variant, for example cyan-700 and amber-700. warninganddangerβ amber-700 and red-700. use matching ansi256 and ansi16 non-bright codes.
- keep
focusBgandfocusTextunchanged across backgrounds. they form an explicit fg/bg pair atlib/ui/theme.ts:163-164,178-179,193-194. - keep
resetanddimunchanged. keep thedisableColorblanking of all tokens atlib/ui/theme.ts:209-226. blanking must also cover the new light values. - export
UiBackgroundfrom the internal barrel atlib/ui/index.ts:30-38. this is not a public package export (package.json:7-38). do not changetest/public-api-contract.test.ts:19-52.
Task 2: carry background through process-global runtime state
make the preference survive every setUiRuntimeOptions() call.
- at
lib/ui/runtime.ts:10-30, addbackgroundto the runtime options interface and defaults. default todark. - at
lib/ui/runtime.ts:51-67, resolve an omittedbackgroundfrom current state. retain the value in the rebuilt object. forward it tocreateUiTheme(). - this preservation is required because
lib/runtime/ui-runtime.ts:8-20and plugin-host paths (index.ts:745,771,3118,3628) call the setter without dashboard fields. - at
lib/ui/runtime.ts:88, makeresetUiRuntimeOptions()restoredark. - without this reset, process-global state can leak between vitest files under the single-worker run (
test/AGENTS.md:170-188).
Task 3: add theme and selector regression tests
current tests assert only that an escape is present. add exact-value assertions so the bug cannot return silently.
- at
test/ui-theme.test.ts:8-41, add table-driven exact assertions for darkheadingandmutedin all three profiles. pin today's values. - in
test/ui-theme.test.ts, add a light-mode matrix: 3 profiles Γ 2 palettes Γ 4 accents. assert exact sgr strings. includeheading === "\x1b[39m". usedisableColor: false, as existing tests do. - assert that
focusBg/focusTextare equal betweendarkandlightfor every profile and palette. - extend
test/ui-theme.test.ts:78-84. withdisableColor: trueandbackground: "light", every token must be"". - in
test/select.test.ts, use the existing tty mock andstdout.writespy attest/select.test.ts:3-38. render a menu with a light theme. include a title, heading item, disabled item, ordinary unselected item, hint, and help text. - assert that the title and ordinary label start with
\x1b[39m. assert that the section heading and help text use lightmuted. assert that the selected row still usesfocusBg + focusText. - flag the missing regression test: no current test covers the
codexColorCode()default branch atlib/ui/select.ts:275. the light-theme render test must cover this branch. - in
test/ui-runtime.test.ts, test that a profile-only update preserves an omittedbackground. test thatresetUiRuntimeOptions()restoresdark. test/ui-format.test.ts:56-63must still pass without changes. badges are intentionally out of scope.
π€ Prompt for AI agents
implement appearance-aware foreground tokens and preserve the background choice
in process-global runtime state. keep dark output byte-identical and keep paired
focus and badge colors unchanged.
- theme construction:
- add `UiBackground = "dark" | "light"` at `lib/ui/theme.ts:5-8` and export it
through `lib/ui/index.ts:30-38` only. leave the public-api contract at
`test/public-api-contract.test.ts:19-52` unchanged.
- add optional `background`, default `dark`, to `createUiTheme()` at
`lib/ui/theme.ts:245-265`. pass it to `getColors()` and accent resolution at
`lib/ui/theme.ts:99-134`.
- for light mode, use terminal default fg `\x1b[39m` for `heading` in all
profiles. use the specified mid-dark slate for `muted`, darker green/blue
palette shades for `primary`/`success`/`border`, darker accent variants,
amber-700 for `warning`, and red-700 for `danger`. use the specified ansi codes
and matching non-bright action/status codes.
- preserve `focusBg`, `focusText`, `reset`, and `dim`. retain all-token
`disableColor` blanking at `lib/ui/theme.ts:209-226`.
- runtime propagation:
- add `background` with default `dark` at `lib/ui/runtime.ts:10-30`.
- at `lib/ui/runtime.ts:51-67`, preserve an omitted value from current state and
forward it into each rebuilt theme.
- reset to `dark` at `lib/ui/runtime.ts:88` to prevent single-worker test-state
leaks.
- regression coverage:
- pin exact dark `heading`/`muted` values in all profiles at
`test/ui-theme.test.ts:8-41`.
- add the 3-profile Γ 2-palette Γ 4-accent light matrix with exact sgr
assertions and `disableColor: false`. compare focus pairs across backgrounds.
extend `test/ui-theme.test.ts:78-84` to verify light-mode blanking.
- use the tty mock and write spy at `test/select.test.ts:3-38` to cover the
title, heading item, disabled item, ordinary unselected item, hint, help text,
and selected focus pair. explicitly cover the previously untested default branch
at `lib/ui/select.ts:275`.
- test background preservation and reset in `test/ui-runtime.test.ts`. keep
`test/ui-format.test.ts:56-63` passing unchanged.
- edit source only. do not edit `dist/`, use `as any`, or add ts suppression
comments. do not change badge tables at `lib/ui/format.ts:43-111`,
`lib/ui/auth-menu-builder.ts:128`, or focus-pair values. flag the latte
muted-plus-dim and windows ansi16 manual checks in the pr.
Phase 2: dashboard preference persistence and propagation
add uiBackgroundMode to every explicit settings inventory. prevent normalization, cloning, equality checks, and keyed persistence from dropping the field. use the existing dashboard preference pattern at lib/dashboard-settings.ts:131-151,293-390.
Task 1: add the persisted field, default, and normalization
- at
lib/dashboard-settings.ts:12-32,49-76, adduiBackgroundMode: "dark" | "light"toDashboardDisplaySettingsand defaults. default todark. - at
lib/dashboard-settings.ts:131-151, add a normalizer. exactly"light"βlight. any other value βdark. keep this case-sensitive, likeuiThemePreset. - at
lib/dashboard-settings.ts:348-352, add the field to explicit reconstruction. without this change, load, legacy migration atlib/dashboard-settings.ts:410-439, and save atlib/dashboard-settings.ts:454-458strip the field. - legacy
dashboard-settings.jsonfiles do not contain the field. normalize them todark. existing users must see no change.
Task 2: update clone, equality, ownership, and the runtime adapter
- at
lib/codex-manager/dashboard-settings-data.ts:41-42, add the field to the clone. atlib/codex-manager/dashboard-settings-data.ts:103-104, add it to the equality comparison. - without the equality change, a background-only edit compares as unchanged at
lib/codex-manager/unified-settings-controller.ts:97-106and never persists. - at
lib/codex-manager/settings-hub/dashboard.ts:160-163, adduiBackgroundModetoTHEME_PANEL_KEYS. this list controls scoped reset and the keyed merge atlib/codex-manager/settings-hub/shared.ts:73-107. - at
lib/codex-manager/settings-hub/dashboard.ts:165-175, mapuiBackgroundModeto runtimebackground, with defaultdark. preserve profile, glyph mode, and v2 enablement. - at
lib/codex-manager/settings-hub/dashboard.ts:126-159, add abackgroundoption inventory next to the palette and accent inventories. - concurrency risk: the save path reloads settings, merges only theme-owned keys, and writes through the unified-settings queue with a stale-record retry at
lib/unified-settings.ts:564-609. the new key must be inTHEME_PANEL_KEYS. otherwise, a concurrent save from another panel or process can overwrite the new key with a stale value. - windows edge case: keep the queued retry for
EBUSY/EPERM(lib/AGENTS.md:281-283). do not add a directfs.writeFilepath. - keep layering intact. do not make
lib/ui/import dashboard settings (lib/AGENTS.md:268-272). only the manager adapter maps the preference.
Task 3: add persistence regression tests
- at
test/dashboard-settings.test.ts:316-401, test defaultdark; preservation of"light"; and normalization of"Light","auto", and42todark. - at
test/dashboard-settings.test.ts:35-112, add a round-trip case. attest/dashboard-settings.test.ts:174, add a legacy migration case with no field. expectdark. - at
test/dashboard-settings-data.test.ts:56-57,131-132, add the field to clone and equality inventories. add a background-only difference case. - at
test/settings-hub-utils.test.ts:715-722, assert that the adapter forwardsbackgroundand preserves the env-selected profile. - at
test/unified-settings-controller.test.ts:82-125, assert that a background-only change persists and reapplies the runtime. - at
test/unified-settings.test.ts:699-862, add a concurrency case. interleave a theme save containinguiBackgroundModewith an unrelated-section write. assert that both values survive. - windows cleanup: use
removeWithRetryfor the concurrency case attest/unified-settings.test.ts:699-862.
π€ Prompt for AI agents
persist `uiBackgroundMode` and propagate it through every explicit settings
inventory. preserve existing appearance by default and prevent background-only
edits or concurrent saves from losing the preference.
- settings schema and normalization:
- add `uiBackgroundMode: "dark" | "light"`, default `dark`, at
`lib/dashboard-settings.ts:12-32,49-76`.
- at `lib/dashboard-settings.ts:131-151`, normalize exactly `"light"` to `light`
and all other values to `dark`. keep normalization case-sensitive.
- include the field in reconstruction at `lib/dashboard-settings.ts:348-352` so
load, legacy migration, and save retain it. legacy files without the field must
resolve to `dark`.
- inventories and adapter:
- include the field in clone and equality at
`lib/codex-manager/dashboard-settings-data.ts:41-42,103-104`. background-only
edits must no longer compare as unchanged.
- add a background option inventory at
`lib/codex-manager/settings-hub/dashboard.ts:126-159`. add `uiBackgroundMode` to
`THEME_PANEL_KEYS` at `lib/codex-manager/settings-hub/dashboard.ts:160-163`.
- map the field to runtime `background`, default `dark`, at
`lib/codex-manager/settings-hub/dashboard.ts:165-175`. preserve profile, glyph
mode, and v2 enablement.
- keep dashboard imports out of `lib/ui/`. map the preference only in the
manager adapter.
- concurrency and windows safeguards:
- retain the reload, theme-owned keyed merge, unified-settings queue, and
stale-record retry at `lib/unified-settings.ts:564-609` and
`lib/codex-manager/settings-hub/shared.ts:73-107`.
- explicitly prevent stale concurrent writes by including the field in
`THEME_PANEL_KEYS`.
- retain queued `EBUSY`/`EPERM` retries. do not add direct `fs.writeFile`
writes.
- tests:
- add normalization, round-trip, and missing-field legacy migration cases at
`test/dashboard-settings.test.ts:35-112,174,316-401`.
- update clone/equality inventories and test a background-only difference at
`test/dashboard-settings-data.test.ts:56-57,131-132`.
- test background forwarding with the env-selected profile preserved at
`test/settings-hub-utils.test.ts:715-722`.
- test persistence and runtime reapplication for background-only edits at
`test/unified-settings-controller.test.ts:82-125`.
- interleave a theme save and unrelated-section write at
`test/unified-settings.test.ts:699-862`. verify both values survive. use
`removeWithRetry` for windows cleanup.
- edit source only. do not edit `dist/`, use `as any`, or add ts suppression
comments.
Phase 3: theme editor, copy, and docs
make the preference discoverable in the theme editor at lib/codex-manager/theme-settings-panel.ts:39-164. retain the live-preview, cancel, and reset contracts (AGENTS.md:155). the reporter tried env workarounds first, but this plan ships only the dashboard preference.
Task 1: add the background selector to the theme panel
- at
lib/codex-manager/theme-settings-panel.ts:11-32, extend the action and options interfaces with background choices. - at
lib/codex-manager/theme-settings-panel.ts:49-106, add "Dark background" and "Light background" rows. mark the current selection with the same marker as palette and accent. - at
lib/codex-manager/theme-settings-panel.ts:156-164, apply the selection to the draft and preview it immediately. the panel renders itself, so this gives a live light preview. - cancel and
qreapply the cloned baseline atlib/codex-manager/theme-settings-panel.ts:134-147. the clone now includes the field, so a light preview must revert correctly. - reset at
lib/codex-manager/theme-settings-panel.ts:150-154restoresdarkthroughTHEME_PANEL_KEYS. - forward the new option inventory through
lib/codex-manager/settings-panels.ts:125-146andlib/codex-manager/settings-hub/dashboard.ts:276-289. - save-failure edge case:
lib/codex-manager/settings-hub/shared.ts:73-107warns and returns a fallback, but the preview stays applied. keep this existing behavior. document it only in the pr.
Task 2: update copy and documentation
- at
lib/ui/ui-copy.ts:144-146,161andlib/codex-manager/settings-hub-menu.ts:37, update theme menu descriptions to mention background mode. - at
docs/reference/settings.md:93-95, add auiBackgroundModerow (dark|light, defaultdark). state thatcodexTuiColorProfileatdocs/reference/settings.md:224controls only color depth, as implemented atlib/config.ts:850-873. - at
docs/configuration.md:99, add a short note: on light terminals, set background to light in settings β theme.CODEX_TUI_COLOR_PROFILEdoes not change appearance.
Task 3: add panel regression tests and run validation
- at
test/settings-panels.test.ts:149-172, assert that the adapter forwards background options. - at
test/codex-manager-cli.test.ts:11539-11583, extend the panel-scoped reset case. after selecting light, reset must restoredark. reset must not change other panels. - add a theme-panel case: select light, then cancel with
q. the runtime must return todark. nothing may persist. - run
npm run typecheck,npm run lint, andnpm test. - keep the 80% coverage thresholds (
test/AGENTS.md:170-188).
π€ Prompt for AI agents
add a discoverable background selector with immediate live preview. preserve
cancel, scoped reset, and existing save-failure behavior while updating copy,
documentation, and regression tests.
- theme panel:
- extend action and options interfaces at
`lib/codex-manager/theme-settings-panel.ts:11-32` with background choices.
- add "Dark background" and "Light background" rows at
`lib/codex-manager/theme-settings-panel.ts:49-106`. use the existing
palette/accent selection marker.
- apply background changes to the draft and preview immediately at
`lib/codex-manager/theme-settings-panel.ts:156-164`.
- keep cancel and `q` restoring the cloned baseline at
`lib/codex-manager/theme-settings-panel.ts:134-147`. use the updated clone to
restore background correctly.
- keep reset restoring `dark` through `THEME_PANEL_KEYS` at
`lib/codex-manager/theme-settings-panel.ts:150-154`.
- forward background options through
`lib/codex-manager/settings-panels.ts:125-146` and
`lib/codex-manager/settings-hub/dashboard.ts:276-289`.
- if save fails, retain the warning, fallback, and applied preview behavior at
`lib/codex-manager/settings-hub/shared.ts:73-107`. document this behavior only
in the pr.
- copy and docs:
- mention background mode in theme descriptions at
`lib/ui/ui-copy.ts:144-146,161` and `lib/codex-manager/settings-hub-menu.ts:37`.
- add the `uiBackgroundMode` row with `dark` | `light` and default `dark` at
`docs/reference/settings.md:93-95`. clarify that `codexTuiColorProfile` controls
only color depth at `docs/reference/settings.md:224`, consistent with
`lib/config.ts:850-873`.
- at `docs/configuration.md:99`, explain that light-terminal users must choose
light background in settings β theme. state that `CODEX_TUI_COLOR_PROFILE` does
not change appearance.
- tests and validation:
- test option forwarding at `test/settings-panels.test.ts:149-172`.
- extend scoped reset at `test/codex-manager-cli.test.ts:11539-11583` to restore
`dark` after selecting light without changing other panels.
- add a light-then-`q` regression case. verify runtime restoration to `dark` and
no persistence.
- run `npm run typecheck`, `npm run lint`, and `npm test`. retain the 80%
coverage thresholds in `test/AGENTS.md:170-188`.
- follow-up constraints:
- edit source only. do not edit `dist/`, use `as any`, or add ts suppression
comments.
- do not add auto-detection, an env override, plugin-host appearance loading, a
fix for the no-color badge escape leak at `lib/ui/format.ts:199-207`, or changes
to the unused `selectedEmphasis` option.
- flag the latte check for muted plus dim at
`lib/codex-manager/formatters/text-style.ts:8-16`. flag manual windows terminal
and conhost checks for palette-dependent ansi16 light values.
Research
ticket summary
the login dashboard uses fixed pale rgb foregrounds for its title, ordinary account rows, section labels, and help text. examples include heading #f0fdf4 and muted #94a3b8 at lib/ui/theme.ts:155-156. these colors are nearly invisible on light terminal themes such as catppuccin latte. this plan adds a persisted dashboard background preference with dark and light values. light selects readable foreground tokens. the existing paired focus and badge backgrounds stay unchanged.
codebase summary
- theme tokens come from
getColors()inlib/ui/theme.ts:147-195. the function uses color profile (truecolor,ansi256,ansi16), palette (green,blue), and accent. headingandmutedare fixed in all three depth branches atlib/ui/theme.ts:155-156,170-171,185-186.select()usesheadingfor the title and ordinary unselected labels through the default branch ofcodexColorCode()atlib/ui/select.ts:262-277.select()usesmutedfor section headings and help text atlib/ui/select.ts:318-408.- selected rows use paired
focusBg/focusTextatlib/ui/select.ts:364-373. - badges use their own hard-coded fg/bg tables at
lib/ui/format.ts:43-111. - process-global runtime state lives in
lib/ui/runtime.ts:10-31,51-67,88. each update rebuilds the theme and preserves omitted options. - dashboard preferences (
uiThemePreset,uiAccentColor) persist in the unifiedsettings.jsondashboardDisplaySettingssection. normalization is explicit atlib/dashboard-settings.ts:131-151,293-390. - explicit clone and equality functions are at
lib/codex-manager/dashboard-settings-data.ts:18-57,72-127. THEME_PANEL_KEYSand the dashboard-to-runtime adapter are atlib/codex-manager/settings-hub/dashboard.ts:160-175.- the live-preview theme editor is at
lib/codex-manager/theme-settings-panel.ts:39-164. - the color profile (
codexTuiColorProfile/CODEX_TUI_COLOR_PROFILE) controls only ansi encoding depth atlib/config.ts:850-873. the color profile does not control light or dark appearance.
file-level change summary
| file | change |
|---|---|
lib/ui/theme.ts:5-8,99-134,147-195,245-265 |
add UiBackground and the background option. add light foreground values. keep focus pairs and disableColor behavior. |
lib/ui/runtime.ts:10-30,51-67,88 |
carry and preserve background. reset it to dark. |
lib/ui/index.ts:30-38 |
export UiBackground from the internal barrel. |
lib/dashboard-settings.ts:12-32,49-76,131-151,348-352 |
add the uiBackgroundMode type, default, normalizer, and reconstruction. |
lib/codex-manager/dashboard-settings-data.ts:41-42,103-104 |
add the field to clone and equality. |
lib/codex-manager/settings-hub/dashboard.ts:126-175,276-289 |
add the option inventory, THEME_PANEL_KEYS, runtime mapping, and di forwarding. |
lib/codex-manager/theme-settings-panel.ts:11-164 |
add selector rows, live preview, cancel, and reset. |
lib/codex-manager/settings-panels.ts:125-146 |
forward the new inventory. |
lib/ui/ui-copy.ts:144-146,161, lib/codex-manager/settings-hub-menu.ts:37 |
update copy. |
docs/reference/settings.md:93-95,224, docs/configuration.md:99 |
update docs. |
| tests listed in tasks 1.3, 2.3, and 3.3 | add exact-value, propagation, concurrency, and cancel/reset regressions. |
follow-up instructions
- edit source only. do not edit
dist/. do not useas anyor ts suppression comments (AGENTS.md:137-174). - do not change
lib/ui/format.ts:43-111badge tables,lib/ui/auth-menu-builder.ts:128, orfocusBg/focusTextvalues atlib/ui/theme.ts:163-164,178-179,193-194. these items draw pale text on their own dark backgrounds. they remain readable on light terminals. - deliberately exclude terminal background auto-detection and an env override.
- deliberately exclude plugin-host loading of dashboard appearance.
index.tsoutput staysdarkunless the user sets the preference. the setter preserves the value only within a manager process. - deliberately exclude the no-color badge escape leak at
lib/ui/format.ts:199-207and the unusedselectedEmphasisoption. - flag this manual check in the pr: light-mode
muted, combined with dim fromlib/codex-manager/formatters/text-style.ts:8-16, needs a check on latte. - flag this windows edge case in the pr: ansi16 light values depend on the terminal palette. check them manually in windows terminal and conhost.
- flag the missing selector regression test: no current test covers the
codexColorCode()default branch atlib/ui/select.ts:275. - flag the concurrency risk: omission from
THEME_PANEL_KEYSatlib/codex-manager/settings-hub/dashboard.ts:160-163can let another panel or process overwrite the new key with a stale value.
π Next Steps
π€ All AI agent prompts combined
Task: 1
implement appearance-aware foreground tokens and preserve the background choice
in process-global runtime state. keep dark output byte-identical and keep paired
focus and badge colors unchanged.
- theme construction:
- add `UiBackground = "dark" | "light"` at `lib/ui/theme.ts:5-8` and export it
through `lib/ui/index.ts:30-38` only. leave the public-api contract at
`test/public-api-contract.test.ts:19-52` unchanged.
- add optional `background`, default `dark`, to `createUiTheme()` at
`lib/ui/theme.ts:245-265`. pass it to `getColors()` and accent resolution at
`lib/ui/theme.ts:99-134`.
- for light mode, use terminal default fg `\x1b[39m` for `heading` in all
profiles. use the specified mid-dark slate for `muted`, darker green/blue
palette shades for `primary`/`success`/`border`, darker accent variants,
amber-700 for `warning`, and red-700 for `danger`. use the specified ansi codes
and matching non-bright action/status codes.
- preserve `focusBg`, `focusText`, `reset`, and `dim`. retain all-token
`disableColor` blanking at `lib/ui/theme.ts:209-226`.
- runtime propagation:
- add `background` with default `dark` at `lib/ui/runtime.ts:10-30`.
- at `lib/ui/runtime.ts:51-67`, preserve an omitted value from current state and
forward it into each rebuilt theme.
- reset to `dark` at `lib/ui/runtime.ts:88` to prevent single-worker test-state
leaks.
- regression coverage:
- pin exact dark `heading`/`muted` values in all profiles at
`test/ui-theme.test.ts:8-41`.
- add the 3-profile Γ 2-palette Γ 4-accent light matrix with exact sgr
assertions and `disableColor: false`. compare focus pairs across backgrounds.
extend `test/ui-theme.test.ts:78-84` to verify light-mode blanking.
- use the tty mock and write spy at `test/select.test.ts:3-38` to cover the
title, heading item, disabled item, ordinary unselected item, hint, help text,
and selected focus pair. explicitly cover the previously untested default branch
at `lib/ui/select.ts:275`.
- test background preservation and reset in `test/ui-runtime.test.ts`. keep
`test/ui-format.test.ts:56-63` passing unchanged.
- edit source only. do not edit `dist/`, use `as any`, or add ts suppression
comments. do not change badge tables at `lib/ui/format.ts:43-111`,
`lib/ui/auth-menu-builder.ts:128`, or focus-pair values. flag the latte
muted-plus-dim and windows ansi16 manual checks in the pr.
===============================================================================
Task: 2
persist `uiBackgroundMode` and propagate it through every explicit settings
inventory. preserve existing appearance by default and prevent background-only
edits or concurrent saves from losing the preference.
- settings schema and normalization:
- add `uiBackgroundMode: "dark" | "light"`, default `dark`, at
`lib/dashboard-settings.ts:12-32,49-76`.
- at `lib/dashboard-settings.ts:131-151`, normalize exactly `"light"` to `light`
and all other values to `dark`. keep normalization case-sensitive.
- include the field in reconstruction at `lib/dashboard-settings.ts:348-352` so
load, legacy migration, and save retain it. legacy files without the field must
resolve to `dark`.
- inventories and adapter:
- include the field in clone and equality at
`lib/codex-manager/dashboard-settings-data.ts:41-42,103-104`. background-only
edits must no longer compare as unchanged.
- add a background option inventory at
`lib/codex-manager/settings-hub/dashboard.ts:126-159`. add `uiBackgroundMode` to
`THEME_PANEL_KEYS` at `lib/codex-manager/settings-hub/dashboard.ts:160-163`.
- map the field to runtime `background`, default `dark`, at
`lib/codex-manager/settings-hub/dashboard.ts:165-175`. preserve profile, glyph
mode, and v2 enablement.
- keep dashboard imports out of `lib/ui/`. map the preference only in the
manager adapter.
- concurrency and windows safeguards:
- retain the reload, theme-owned keyed merge, unified-settings queue, and
stale-record retry at `lib/unified-settings.ts:564-609` and
`lib/codex-manager/settings-hub/shared.ts:73-107`.
- explicitly prevent stale concurrent writes by including the field in
`THEME_PANEL_KEYS`.
- retain queued `EBUSY`/`EPERM` retries. do not add direct `fs.writeFile`
writes.
- tests:
- add normalization, round-trip, and missing-field legacy migration cases at
`test/dashboard-settings.test.ts:35-112,174,316-401`.
- update clone/equality inventories and test a background-only difference at
`test/dashboard-settings-data.test.ts:56-57,131-132`.
- test background forwarding with the env-selected profile preserved at
`test/settings-hub-utils.test.ts:715-722`.
- test persistence and runtime reapplication for background-only edits at
`test/unified-settings-controller.test.ts:82-125`.
- interleave a theme save and unrelated-section write at
`test/unified-settings.test.ts:699-862`. verify both values survive. use
`removeWithRetry` for windows cleanup.
- edit source only. do not edit `dist/`, use `as any`, or add ts suppression
comments.
===============================================================================
Task: 3
add a discoverable background selector with immediate live preview. preserve
cancel, scoped reset, and existing save-failure behavior while updating copy,
documentation, and regression tests.
- theme panel:
- extend action and options interfaces at
`lib/codex-manager/theme-settings-panel.ts:11-32` with background choices.
- add "Dark background" and "Light background" rows at
`lib/codex-manager/theme-settings-panel.ts:49-106`. use the existing
palette/accent selection marker.
- apply background changes to the draft and preview immediately at
`lib/codex-manager/theme-settings-panel.ts:156-164`.
- keep cancel and `q` restoring the cloned baseline at
`lib/codex-manager/theme-settings-panel.ts:134-147`. use the updated clone to
restore background correctly.
- keep reset restoring `dark` through `THEME_PANEL_KEYS` at
`lib/codex-manager/theme-settings-panel.ts:150-154`.
- forward background options through
`lib/codex-manager/settings-panels.ts:125-146` and
`lib/codex-manager/settings-hub/dashboard.ts:276-289`.
- if save fails, retain the warning, fallback, and applied preview behavior at
`lib/codex-manager/settings-hub/shared.ts:73-107`. document this behavior only
in the pr.
- copy and docs:
- mention background mode in theme descriptions at
`lib/ui/ui-copy.ts:144-146,161` and `lib/codex-manager/settings-hub-menu.ts:37`.
- add the `uiBackgroundMode` row with `dark` | `light` and default `dark` at
`docs/reference/settings.md:93-95`. clarify that `codexTuiColorProfile` controls
only color depth at `docs/reference/settings.md:224`, consistent with
`lib/config.ts:850-873`.
- at `docs/configuration.md:99`, explain that light-terminal users must choose
light background in settings β theme. state that `CODEX_TUI_COLOR_PROFILE` does
not change appearance.
- tests and validation:
- test option forwarding at `test/settings-panels.test.ts:149-172`.
- extend scoped reset at `test/codex-manager-cli.test.ts:11539-11583` to restore
`dark` after selecting light without changing other panels.
- add a light-then-`q` regression case. verify runtime restoration to `dark` and
no persistence.
- run `npm run typecheck`, `npm run lint`, and `npm test`. retain the 80%
coverage thresholds in `test/AGENTS.md:170-188`.
- follow-up constraints:
- edit source only. do not edit `dist/`, use `as any`, or add ts suppression
comments.
- do not add auto-detection, an env override, plugin-host appearance loading, a
fix for the no-color badge escape leak at `lib/ui/format.ts:199-207`, or changes
to the unused `selectedEmphasis` option.
- flag the latte check for muted plus dim at
`lib/codex-manager/formatters/text-style.ts:8-16`. flag manual windows terminal
and conhost checks for palette-dependent ansi16 light values.
π‘ Iterate on the plan with:
@coderabbitai <feedback>
Example Feedback
- @coderabbitai You can skip phase 3. Add a simple unit test case for phase 2.
- @coderabbitai For design choice 1 go ahead with option 3 and replan.