Files
skillshare/internal/theme/palette_light.go
T
Willie 36e22477fe feat(theme): add internal/theme package with palettes and detection
Introduces a unified light/dark terminal theme system:
- Theme struct with sync.Once-backed Get()/Reset() singleton
- darkPalette (softened Primary from 15 to 252) and lightPalette
  (new, WCAG AA compliant against white backgrounds)
- Style constructors (Primary, Muted, Accent, Success, Warning,
  Danger, Info, Title, SelectedRow, Badge, Severity)
- ANSISet for plain CLI output
- Resolution precedence: NO_COLOR > SKILLSHARE_THEME > OSC 11 probe
  > dark fallback
- 300ms timeout on OSC 11 probe with documented goroutine leak tradeoff
- canDetect() gate for non-TTY, CI, TERM=dumb, Windows-safe
- WCAG contrast tests as regression guard for future palette edits

NO_COLOR env var follows the no-color.org spec: only activates when
set AND non-empty (empty string does not enable no-color mode).

This commit adds the package but does not migrate any existing
callers. The next commits migrate list TUIs (fixes #125), plain CLI
output, and remaining TUIs.

Refs: #125
2026-04-10 14:26:44 +08:00

36 lines
1.1 KiB
Go

package theme
import "github.com/charmbracelet/lipgloss"
// lightPalette is tuned for light terminal backgrounds.
//
// Key differences vs darkPalette:
// - All foreground colors use dark shades (near black 232, dark blue 25,
// etc.) to meet WCAG AA contrast against white backgrounds.
// - Warning uses 130 (dark gold) instead of 3 (yellow) because yellow
// on white has < 2:1 contrast ratio (unreadable).
// - SeverityLow uses 25 (dark blue) instead of 12 (bright blue) for
// the same reason.
var lightPalette = palette{
Primary: lipgloss.Color("232"),
Muted: lipgloss.Color("240"),
Accent: lipgloss.Color("25"),
Selected: lipgloss.Color("232"),
SelectedBg: lipgloss.Color("252"),
Success: lipgloss.Color("28"),
Warning: lipgloss.Color("130"),
Danger: lipgloss.Color("124"),
Info: lipgloss.Color("25"),
BadgeFg: lipgloss.Color("232"),
BadgeBg: lipgloss.Color("252"),
SeverityCritical: lipgloss.Color("160"),
SeverityHigh: lipgloss.Color("208"),
SeverityMedium: lipgloss.Color("130"),
SeverityLow: lipgloss.Color("25"),
SeverityInfo: lipgloss.Color("240"),
}