Skip to content

Commit

Permalink
Add basic support for light backgrounds
Browse files Browse the repository at this point in the history
Fixes #37.
  • Loading branch information
meowgorithm committed Dec 10, 2021
1 parent bdee7eb commit ddff8b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 11 additions & 1 deletion internal/tui/bubbles/repo/bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/charmbracelet/bubbles/viewport"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/glamour"
"github.com/charmbracelet/glamour/ansi"
"github.com/charmbracelet/lipgloss"
"github.com/charmbracelet/soft-serve/internal/git"
"github.com/charmbracelet/soft-serve/internal/tui/style"
Expand All @@ -21,6 +22,15 @@ const (
repoNameMaxWidth = 32
)

var glamourStyle = func() ansi.StyleConfig {
noColor := ""
s := glamour.DarkStyleConfig
s.Document.StylePrimitive.Color = &noColor
s.CodeBlock.Chroma.Text.Color = &noColor
s.CodeBlock.Chroma.Name.Color = &noColor
return s
}()

type ErrMsg struct {
Error error
}
Expand Down Expand Up @@ -203,7 +213,7 @@ func (b *Bubble) glamourize(md string) (string, error) {
w = glamourMaxWidth
}
tr, err := glamour.NewTermRenderer(
glamour.WithStandardStyle("dark"),
glamour.WithStyles(glamourStyle),
glamour.WithWordWrap(w),
)

Expand Down
4 changes: 1 addition & 3 deletions internal/tui/style/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func DefaultStyles() *Styles {
SetString(">")

s.MenuItem = lipgloss.NewStyle().
Foreground(lipgloss.Color("252")).
PaddingLeft(2)

s.SelectedMenuItem = lipgloss.NewStyle().
Expand Down Expand Up @@ -106,8 +105,7 @@ func DefaultStyles() *Styles {
}

s.RepoTitle = lipgloss.NewStyle().
Padding(0, 2).
Foreground(lipgloss.Color("252"))
Padding(0, 2)

s.RepoTitleBox = lipgloss.NewStyle().
BorderStyle(s.RepoTitleBorder).
Expand Down

0 comments on commit ddff8b0

Please sign in to comment.