style.go

 1package uiutils
 2
 3import (
 4	"github.com/charmbracelet/glamour"
 5	"github.com/charmbracelet/glamour/ansi"
 6)
 7
 8func strptr(s string) *string {
 9	return &s
10}
11
12// StyleConfig returns the default Glamour style configuration.
13func StyleConfig() ansi.StyleConfig {
14	noColor := strptr("")
15	s := glamour.DarkStyleConfig
16	s.H1.BackgroundColor = noColor
17	s.H1.Prefix = "# "
18	s.H1.Suffix = ""
19	s.H1.Color = strptr("39")
20	s.Document.StylePrimitive.Color = noColor
21	s.CodeBlock.Chroma.Text.Color = noColor
22	s.CodeBlock.Chroma.Name.Color = noColor
23	// This fixes an issue with the default style config. For example
24	// highlighting empty spaces with red in Dockerfile type.
25	s.CodeBlock.Chroma.Error.BackgroundColor = noColor
26	return s
27}