ddff8b01c8377ee4d024d7431bbc2def2cd595ea

Author
Christian Rocha <christian@rocha.is>
Committer
Christian Rocha <christian@rocha.is>
Date

Message

Add basic support for light backgrounds

Fixes #37.

Diff

 1diff --git a/internal/tui/bubbles/repo/bubble.go b/internal/tui/bubbles/repo/bubble.go
 2index 63bf8853655a475e8458fa93a69032aaa575da77..e50c4cefe03de86c15419577e1caa92437cacce0 100644
 3--- a/internal/tui/bubbles/repo/bubble.go
 4+++ b/internal/tui/bubbles/repo/bubble.go
 5@@ -9,6 +9,7 @@ import (
 6 	"github.com/charmbracelet/bubbles/viewport"
 7 	tea "github.com/charmbracelet/bubbletea"
 8 	"github.com/charmbracelet/glamour"
 9+	"github.com/charmbracelet/glamour/ansi"
10 	"github.com/charmbracelet/lipgloss"
11 	"github.com/charmbracelet/soft-serve/internal/git"
12 	"github.com/charmbracelet/soft-serve/internal/tui/style"
13@@ -21,6 +22,15 @@ const (
14 	repoNameMaxWidth = 32
15 )
16 
17+var glamourStyle = func() ansi.StyleConfig {
18+	noColor := ""
19+	s := glamour.DarkStyleConfig
20+	s.Document.StylePrimitive.Color = &noColor
21+	s.CodeBlock.Chroma.Text.Color = &noColor
22+	s.CodeBlock.Chroma.Name.Color = &noColor
23+	return s
24+}()
25+
26 type ErrMsg struct {
27 	Error error
28 }
29@@ -203,7 +213,7 @@ func (b *Bubble) glamourize(md string) (string, error) {
30 		w = glamourMaxWidth
31 	}
32 	tr, err := glamour.NewTermRenderer(
33-		glamour.WithStandardStyle("dark"),
34+		glamour.WithStyles(glamourStyle),
35 		glamour.WithWordWrap(w),
36 	)
37 
38diff --git a/internal/tui/style/style.go b/internal/tui/style/style.go
39index b35a62efc36307619527f2b0769ced58d0574ea3..9377fb0e3b78256023147b396ab9adbfd20c9f69 100644
40--- a/internal/tui/style/style.go
41+++ b/internal/tui/style/style.go
42@@ -65,7 +65,6 @@ func DefaultStyles() *Styles {
43 		SetString(">")
44 
45 	s.MenuItem = lipgloss.NewStyle().
46-		Foreground(lipgloss.Color("252")).
47 		PaddingLeft(2)
48 
49 	s.SelectedMenuItem = lipgloss.NewStyle().
50@@ -106,8 +105,7 @@ func DefaultStyles() *Styles {
51 	}
52 
53 	s.RepoTitle = lipgloss.NewStyle().
54-		Padding(0, 2).
55-		Foreground(lipgloss.Color("252"))
56+		Padding(0, 2)
57 
58 	s.RepoTitleBox = lipgloss.NewStyle().
59 		BorderStyle(s.RepoTitleBorder).