diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-05 19:34:01 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-05 19:34:01 +0200 |
| commit | 5fe164e91e40e8a3f749f4143f7562f940bf9f67 (patch) | |
| tree | d77b03c737628fa58171de28eb89720c96f203b2 /internal/tui/common/styles_test.go | |
| parent | a44f6ee30c11963552b5b90a19698873aa9b6b6d (diff) | |
feat(tui): detect terminal theme and apply palettes
Diffstat (limited to 'internal/tui/common/styles_test.go')
| -rw-r--r-- | internal/tui/common/styles_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/internal/tui/common/styles_test.go b/internal/tui/common/styles_test.go new file mode 100644 index 0000000..c0900b3 --- /dev/null +++ b/internal/tui/common/styles_test.go @@ -0,0 +1,39 @@ +package common + +import ( + "testing" + + "charm.land/lipgloss/v2" +) + +func TestNewPaletteRendersDistinctThemes(t *testing.T) { + dark := NewPalette(true) + light := NewPalette(false) + + darkRender := lipgloss.NewStyle(). + Foreground(dark.Text). + Background(dark.Background). + Render("ior") + lightRender := lipgloss.NewStyle(). + Foreground(light.Text). + Background(light.Background). + Render("ior") + + if darkRender == lightRender { + t.Fatalf("expected dark and light palettes to render differently") + } +} + +func TestApplyPaletteUpdatesSharedStyles(t *testing.T) { + t.Cleanup(func() { ApplyPalette(true) }) + + ApplyPalette(true) + dark := ScreenStyle.Render("ior") + + ApplyPalette(false) + light := ScreenStyle.Render("ior") + + if dark == light { + t.Fatalf("expected ScreenStyle render to differ between dark and light palettes") + } +} |
