@@ -25,48 +25,63 @@ const (
25 layoutSplit
25 layoutSplit
28+type LineStyle struct {
29+ Symbol lipgloss.Style
28type Style struct {
33type Style struct {
29− Base lipgloss.Style
34+ EqualLine LineStyle
30− InsertLine lipgloss.Style
35+ InsertLine LineStyle
31− InsertSymbols lipgloss.Style
32− DeleteLine lipgloss.Style
36+ DeleteLine LineStyle
33− DeleteSymbols lipgloss.Style
36var DefaultLightStyle = Style{
39var DefaultLightStyle = Style{
40+ EqualLine: LineStyle{
37− Base: lipgloss.NewStyle().
41+ Code: lipgloss.NewStyle().
38− Foreground(charmtone.Pepper).
42+ Foreground(charmtone.Pepper).
39− Background(charmtone.Salt),
43+ Background(charmtone.Salt),
40− InsertLine: lipgloss.NewStyle().
45+ InsertLine: LineStyle{
41− Foreground(charmtone.Pepper).
42− Background(lipgloss.Color("#e8f5e9")),
43− InsertSymbols: lipgloss.NewStyle().
46+ Symbol: lipgloss.NewStyle().
44− Foreground(charmtone.Turtle).
47+ Foreground(charmtone.Turtle).
48+ Background(lipgloss.Color("#e8f5e9")),
49+ Code: lipgloss.NewStyle().
50+ Foreground(charmtone.Pepper).
45− Background(lipgloss.Color("#e8f5e9")),
51+ Background(lipgloss.Color("#e8f5e9")),
46− DeleteLine: lipgloss.NewStyle().
53+ DeleteLine: LineStyle{
47− Foreground(charmtone.Pepper).
48− Background(lipgloss.Color("#ffebee")),
49− DeleteSymbols: lipgloss.NewStyle().
54+ Symbol: lipgloss.NewStyle().
50− Foreground(charmtone.Cherry).
55+ Foreground(charmtone.Cherry).
56+ Background(lipgloss.Color("#ffebee")),
57+ Code: lipgloss.NewStyle().
58+ Foreground(charmtone.Pepper).
51− Background(lipgloss.Color("#ffebee")),
59+ Background(lipgloss.Color("#ffebee")),
54var DefaultDarkStyle = Style{
63var DefaultDarkStyle = Style{
64+ EqualLine: LineStyle{
55− Base: lipgloss.NewStyle().
65+ Code: lipgloss.NewStyle().
56− Foreground(charmtone.Salt).
66+ Foreground(charmtone.Salt).
57− Background(charmtone.Pepper),
67+ Background(charmtone.Pepper),
58− InsertLine: lipgloss.NewStyle().
69+ InsertLine: LineStyle{
59− Foreground(charmtone.Salt).
60− Background(lipgloss.Color("#303a30")),
61− InsertSymbols: lipgloss.NewStyle().
70+ Symbol: lipgloss.NewStyle().
62− Foreground(charmtone.Turtle).
71+ Foreground(charmtone.Turtle).
72+ Background(lipgloss.Color("#303a30")),
73+ Code: lipgloss.NewStyle().
74+ Foreground(charmtone.Salt).
63− Background(lipgloss.Color("#303a30")),
75+ Background(lipgloss.Color("#303a30")),
64− DeleteLine: lipgloss.NewStyle().
77+ DeleteLine: LineStyle{
65− Foreground(charmtone.Salt).
66− Background(lipgloss.Color("#3a3030")),
67− DeleteSymbols: lipgloss.NewStyle().
78+ Symbol: lipgloss.NewStyle().
68− Foreground(charmtone.Cherry).
79+ Foreground(charmtone.Cherry).
80+ Background(lipgloss.Color("#3a3030")),
81+ Code: lipgloss.NewStyle().
82+ Foreground(charmtone.Salt).
69− Background(lipgloss.Color("#3a3030")),
83+ Background(lipgloss.Color("#3a3030")),
72// DiffView represents a view for displaying differences between two files.
87// DiffView represents a view for displaying differences between two files.
@@ -170,13 +185,13 @@ func (dv *DiffView) String() string {
171 switch l.Kind {
186 switch l.Kind {
172 case udiff.Insert:
187 case udiff.Insert:
173− b.WriteString(dv.style.InsertSymbols.Render("+ "))
188+ b.WriteString(dv.style.InsertLine.Symbol.Render("+ "))
174− b.WriteString(dv.style.InsertLine.Width(width).Render(content))
189+ b.WriteString(dv.style.InsertLine.Code.Width(width).Render(content))
175 case udiff.Delete:
190 case udiff.Delete:
176− b.WriteString(dv.style.DeleteSymbols.Render("- "))
191+ b.WriteString(dv.style.DeleteLine.Symbol.Render("- "))
177− b.WriteString(dv.style.DeleteLine.Width(width).Render(content))
192+ b.WriteString(dv.style.DeleteLine.Code.Width(width).Render(content))
178 case udiff.Equal:
193 case udiff.Equal:
179− b.WriteString(dv.style.Base.Width(width + leadingSymbolsSize).Render(" " + content))
194+ b.WriteString(dv.style.EqualLine.Code.Width(width + leadingSymbolsSize).Render(" " + content))
181 b.WriteRune('\n')
196 b.WriteRune('\n')