feat(tui): add LIGHT_THEME preset for white/light terminal backgrounds

Splits the existing palette into DARK_THEME (current yellow-heavy
default) and LIGHT_THEME (darker browns + proper contrast on white).
DEFAULT_THEME aliases DARK_THEME, and flips to LIGHT_THEME when
HERMES_TUI_LIGHT=1 is set at launch.

Skin system (fromSkin) still layers on top of whichever preset is
active, so users can keep customizing on top of either palette.

Refs #11300.
This commit is contained in:
Brooklyn Nicholson 2026-04-18 17:49:40 -05:00
parent 3366714ba4
commit 20eab355e7
2 changed files with 80 additions and 11 deletions

View file

@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest'
import { DEFAULT_THEME, fromSkin } from '../theme.js'
import { DARK_THEME, DEFAULT_THEME, fromSkin, LIGHT_THEME } from '../theme.js'
describe('DEFAULT_THEME', () => {
it('has brand defaults', () => {
@ -15,6 +15,26 @@ describe('DEFAULT_THEME', () => {
})
})
describe('LIGHT_THEME', () => {
it('avoids bright-yellow accents unreadable on white backgrounds (#11300)', () => {
expect(LIGHT_THEME.color.gold).not.toBe('#FFD700')
expect(LIGHT_THEME.color.amber).not.toBe('#FFBF00')
expect(LIGHT_THEME.color.dim).not.toBe('#B8860B')
expect(LIGHT_THEME.color.statusWarn).not.toBe('#FFD700')
})
it('keeps the same shape as DARK_THEME', () => {
expect(Object.keys(LIGHT_THEME.color).sort()).toEqual(Object.keys(DARK_THEME.color).sort())
expect(LIGHT_THEME.brand).toEqual(DARK_THEME.brand)
})
})
describe('DEFAULT_THEME aliasing', () => {
it('defaults to DARK_THEME when HERMES_TUI_LIGHT is unset', () => {
expect(DEFAULT_THEME).toBe(DARK_THEME)
})
})
describe('fromSkin', () => {
it('overrides banner colors', () => {
expect(fromSkin({ banner_title: '#FF0000' }, {}).color.gold).toBe('#FF0000')