55
66 "github.com/alecthomas/chroma/v2"
77 "github.com/alecthomas/chroma/v2/lexers"
8- chromastyles "github.com/alecthomas/chroma/v2/styles"
98 "github.com/aymanbagabas/go-udiff"
109 "github.com/charmbracelet/lipgloss/v2"
1110 "github.com/mattn/go-runewidth"
@@ -21,11 +20,7 @@ func syntaxHighlight(code, filePath string) []chromaToken {
2120 }
2221 lexer = chroma .Coalesce (lexer )
2322
24- style := chromastyles .Get ("monokai" )
25- if style == nil {
26- style = chromastyles .Fallback
27- }
28-
23+ style := styles .ChromaStyle ()
2924 iterator , err := lexer .Tokenise (nil , code )
3025 if err != nil {
3126 return []chromaToken {{Text : code , Style : lipgloss .NewStyle ()}}
@@ -57,13 +52,11 @@ func chromaToLipgloss(tokenType chroma.TokenType, style *chroma.Style) lipgloss.
5752 lipStyle := lipgloss .NewStyle ()
5853
5954 if entry .Colour .IsSet () {
60- color := entry .Colour .String ()
61- lipStyle = lipStyle .Foreground (lipgloss .Color (color ))
55+ lipStyle = lipStyle .Foreground (lipgloss .Color (entry .Colour .String ()))
6256 }
6357
6458 if entry .Background .IsSet () {
65- color := entry .Background .String ()
66- lipStyle = lipStyle .Background (lipgloss .Color (color ))
59+ lipStyle = lipStyle .Background (lipgloss .Color (entry .Background .String ()))
6760 }
6861
6962 if entry .Bold == chroma .Yes {
0 commit comments