diff --git a/internal/exp/diffview/diffview.go b/internal/exp/diffview/diffview.go index 92dca75aaf59f26b959ad12506a6d7f414b80c98..6e8fe858d10455a85455ec371b421ef272d78d9e 100644 --- a/internal/exp/diffview/diffview.go +++ b/internal/exp/diffview/diffview.go @@ -69,7 +69,7 @@ func New() *DiffView { lineNumbers: true, tabWidth: 8, } - dv.style = DefaultDarkStyle + dv.style = DefaultDarkStyle() return dv } diff --git a/internal/exp/diffview/diffview_test.go b/internal/exp/diffview/diffview_test.go index 847f380a316ac4a1241968d7da8597d3d9b34944..28e84716624d4b0f9efdc4044da74e438cf04b33 100644 --- a/internal/exp/diffview/diffview_test.go +++ b/internal/exp/diffview/diffview_test.go @@ -97,12 +97,12 @@ var ( LightModeFunc = func(dv *diffview.DiffView) *diffview.DiffView { return dv. - Style(diffview.DefaultLightStyle). + Style(diffview.DefaultLightStyle()). ChromaStyle(styles.Get("catppuccin-latte")) } DarkModeFunc = func(dv *diffview.DiffView) *diffview.DiffView { return dv. - Style(diffview.DefaultDarkStyle). + Style(diffview.DefaultDarkStyle()). ChromaStyle(styles.Get("catppuccin-macchiato")) } @@ -165,7 +165,7 @@ func TestDiffViewTabs(t *testing.T) { dv := diffview.New(). Before("main.go", TestTabsBefore). After("main.go", TestTabsAfter). - Style(diffview.DefaultLightStyle). + Style(diffview.DefaultLightStyle()). ChromaStyle(styles.Get("catppuccin-latte")) dv = layoutFunc(dv) @@ -190,7 +190,7 @@ func TestDiffViewWidth(t *testing.T) { Before("main.go", TestMultipleHunksBefore). After("main.go", TestMultipleHunksAfter). Width(width). - Style(diffview.DefaultLightStyle). + Style(diffview.DefaultLightStyle()). ChromaStyle(styles.Get("catppuccin-latte")) dv = layoutFunc(dv) @@ -215,7 +215,7 @@ func TestDiffViewHeight(t *testing.T) { Before("main.go", TestMultipleHunksBefore). After("main.go", TestMultipleHunksAfter). Height(height). - Style(diffview.DefaultLightStyle). + Style(diffview.DefaultLightStyle()). ChromaStyle(styles.Get("catppuccin-latte")) dv = layoutFunc(dv) @@ -239,7 +239,7 @@ func TestDiffViewXOffset(t *testing.T) { dv := diffview.New(). Before("main.go", TestDefaultBefore). After("main.go", TestDefaultAfter). - Style(diffview.DefaultLightStyle). + Style(diffview.DefaultLightStyle()). ChromaStyle(styles.Get("catppuccin-latte")). Width(60). XOffset(xOffset) @@ -265,7 +265,7 @@ func TestDiffViewYOffset(t *testing.T) { dv := diffview.New(). Before("main.go", TestMultipleHunksBefore). After("main.go", TestMultipleHunksAfter). - Style(diffview.DefaultLightStyle). + Style(diffview.DefaultLightStyle()). ChromaStyle(styles.Get("catppuccin-latte")). Height(5). YOffset(yOffset) diff --git a/internal/exp/diffview/style.go b/internal/exp/diffview/style.go index 83d7baeca9c59af9d465e9b130ae742d3138b7ce..e24f67ec7f1aee809cb058ca11268562ff00d74e 100644 --- a/internal/exp/diffview/style.go +++ b/internal/exp/diffview/style.go @@ -24,97 +24,101 @@ type Style struct { } // DefaultLightStyle provides a default light theme style for the diff view. -var DefaultLightStyle = Style{ - DividerLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Iron). - Background(charmtone.Thunder), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Oyster). - Background(charmtone.Anchovy), - }, - MissingLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Background(charmtone.Ash), - Code: lipgloss.NewStyle(). - Background(charmtone.Ash), - }, - EqualLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Charcoal). - Background(charmtone.Ash), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Pepper). - Background(charmtone.Salt), - }, - InsertLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Turtle). - Background(lipgloss.Color("#c8e6c9")), - Symbol: lipgloss.NewStyle(). - Foreground(charmtone.Turtle). - Background(lipgloss.Color("#e8f5e9")), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Pepper). - Background(lipgloss.Color("#e8f5e9")), - }, - DeleteLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Cherry). - Background(lipgloss.Color("#ffcdd2")), - Symbol: lipgloss.NewStyle(). - Foreground(charmtone.Cherry). - Background(lipgloss.Color("#ffebee")), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Pepper). - Background(lipgloss.Color("#ffebee")), - }, +func DefaultLightStyle() Style { + return Style{ + DividerLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Iron). + Background(charmtone.Thunder), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Oyster). + Background(charmtone.Anchovy), + }, + MissingLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Background(charmtone.Ash), + Code: lipgloss.NewStyle(). + Background(charmtone.Ash), + }, + EqualLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Charcoal). + Background(charmtone.Ash), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Pepper). + Background(charmtone.Salt), + }, + InsertLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Turtle). + Background(lipgloss.Color("#c8e6c9")), + Symbol: lipgloss.NewStyle(). + Foreground(charmtone.Turtle). + Background(lipgloss.Color("#e8f5e9")), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Pepper). + Background(lipgloss.Color("#e8f5e9")), + }, + DeleteLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Cherry). + Background(lipgloss.Color("#ffcdd2")), + Symbol: lipgloss.NewStyle(). + Foreground(charmtone.Cherry). + Background(lipgloss.Color("#ffebee")), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Pepper). + Background(lipgloss.Color("#ffebee")), + }, + } } // DefaultDarkStyle provides a default dark theme style for the diff view. -var DefaultDarkStyle = Style{ - DividerLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Smoke). - Background(charmtone.Sapphire), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Smoke). - Background(charmtone.Ox), - }, - MissingLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Background(charmtone.Charcoal), - Code: lipgloss.NewStyle(). - Background(charmtone.Charcoal), - }, - EqualLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Ash). - Background(charmtone.Charcoal), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Salt). - Background(charmtone.Pepper), - }, - InsertLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Turtle). - Background(lipgloss.Color("#293229")), - Symbol: lipgloss.NewStyle(). - Foreground(charmtone.Turtle). - Background(lipgloss.Color("#303a30")), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Salt). - Background(lipgloss.Color("#303a30")), - }, - DeleteLine: LineStyle{ - LineNumber: lipgloss.NewStyle(). - Foreground(charmtone.Cherry). - Background(lipgloss.Color("#332929")), - Symbol: lipgloss.NewStyle(). - Foreground(charmtone.Cherry). - Background(lipgloss.Color("#3a3030")), - Code: lipgloss.NewStyle(). - Foreground(charmtone.Salt). - Background(lipgloss.Color("#3a3030")), - }, +func DefaultDarkStyle() Style { + return Style{ + DividerLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Smoke). + Background(charmtone.Sapphire), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Smoke). + Background(charmtone.Ox), + }, + MissingLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Background(charmtone.Charcoal), + Code: lipgloss.NewStyle(). + Background(charmtone.Charcoal), + }, + EqualLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Ash). + Background(charmtone.Charcoal), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Salt). + Background(charmtone.Pepper), + }, + InsertLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Turtle). + Background(lipgloss.Color("#293229")), + Symbol: lipgloss.NewStyle(). + Foreground(charmtone.Turtle). + Background(lipgloss.Color("#303a30")), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Salt). + Background(lipgloss.Color("#303a30")), + }, + DeleteLine: LineStyle{ + LineNumber: lipgloss.NewStyle(). + Foreground(charmtone.Cherry). + Background(lipgloss.Color("#332929")), + Symbol: lipgloss.NewStyle(). + Foreground(charmtone.Cherry). + Background(lipgloss.Color("#3a3030")), + Code: lipgloss.NewStyle(). + Foreground(charmtone.Salt). + Background(lipgloss.Color("#3a3030")), + }, + } }