@@ -1,8 +1,10 @@
1package styles
1package styles
4+ "github.com/charmbracelet/glamour"
4 "github.com/charmbracelet/glamour/ansi"
5 "github.com/charmbracelet/glamour/ansi"
5 "github.com/charmbracelet/lipgloss"
6 "github.com/charmbracelet/lipgloss"
7+ "github.com/opencode-ai/opencode/internal/tui/theme"
8const defaultMargin = 1
10const defaultMargin = 1
@@ -12,930 +14,271 @@ func boolPtr(b bool) *bool { return &b }
12func stringPtr(s string) *string { return &s }
14func stringPtr(s string) *string { return &s }
13func uintPtr(u uint) *uint { return &u }
15func uintPtr(u uint) *uint { return &u }
15−// CatppuccinMarkdownStyle is the Catppuccin Mocha style for Glamour markdown rendering.
17+// returns a glamour TermRenderer configured with the current theme
16−func CatppuccinMarkdownStyle() ansi.StyleConfig {
18+func GetMarkdownRenderer(width int) *glamour.TermRenderer {
17− isDark := lipgloss.HasDarkBackground()
19+ r, _ := glamour.NewTermRenderer(
18− if isDark {
20+ glamour.WithStyles(generateMarkdownStyleConfig()),
19− return catppuccinDark
21+ glamour.WithWordWrap(width),
21− return catppuccinLight
23+ return r
24−var catppuccinDark = ansi.StyleConfig{
26+// creates an ansi.StyleConfig for markdown rendering
27+// using adaptive colors from the provided theme.
28+func generateMarkdownStyleConfig() ansi.StyleConfig {
29+ t := theme.CurrentTheme()
31+ return ansi.StyleConfig{
25− Document: ansi.StyleBlock{
32+ Document: ansi.StyleBlock{
26− StylePrimitive: ansi.StylePrimitive{
29− Color: stringPtr(dark.Text().Hex),
31− Margin: uintPtr(defaultMargin),
33− BlockQuote: ansi.StyleBlock{
34− StylePrimitive: ansi.StylePrimitive{
35− Color: stringPtr(dark.Yellow().Hex),
36− Italic: boolPtr(true),
40− IndentToken: stringPtr(BaseStyle.Render(" ")),
42− List: ansi.StyleList{
43− LevelIndent: defaultMargin,
44− StyleBlock: ansi.StyleBlock{
45− IndentToken: stringPtr(BaseStyle.Render(" ")),
46− StylePrimitive: ansi.StylePrimitive{
47− Color: stringPtr(dark.Text().Hex),
51− Heading: ansi.StyleBlock{
52− StylePrimitive: ansi.StylePrimitive{
54− Color: stringPtr(dark.Mauve().Hex),
59− StylePrimitive: ansi.StylePrimitive{
61− Color: stringPtr(dark.Lavender().Hex),
67− StylePrimitive: ansi.StylePrimitive{
69− Color: stringPtr(dark.Mauve().Hex),
74− StylePrimitive: ansi.StylePrimitive{
76− Color: stringPtr(dark.Pink().Hex),
81− StylePrimitive: ansi.StylePrimitive{
83− Color: stringPtr(dark.Flamingo().Hex),
88− StylePrimitive: ansi.StylePrimitive{
90− Color: stringPtr(dark.Rosewater().Hex),
95− StylePrimitive: ansi.StylePrimitive{
97− Color: stringPtr(dark.Rosewater().Hex),
101− Strikethrough: ansi.StylePrimitive{
102− CrossedOut: boolPtr(true),
103− Color: stringPtr(dark.Overlay1().Hex),
105− Emph: ansi.StylePrimitive{
106− Color: stringPtr(dark.Yellow().Hex),
107− Italic: boolPtr(true),
109− Strong: ansi.StylePrimitive{
110− Bold: boolPtr(true),
111− Color: stringPtr(dark.Peach().Hex),
113− HorizontalRule: ansi.StylePrimitive{
114− Color: stringPtr(dark.Overlay0().Hex),
115− Format: "\n─────────────────────────────────────────\n",
117− Item: ansi.StylePrimitive{
119− Color: stringPtr(dark.Blue().Hex),
121− Enumeration: ansi.StylePrimitive{
123− Color: stringPtr(dark.Sky().Hex),
125− Task: ansi.StyleTask{
126− StylePrimitive: ansi.StylePrimitive{},
130− Link: ansi.StylePrimitive{
131− Color: stringPtr(dark.Sky().Hex),
132− Underline: boolPtr(true),
134− LinkText: ansi.StylePrimitive{
135− Color: stringPtr(dark.Pink().Hex),
136− Bold: boolPtr(true),
138− Image: ansi.StylePrimitive{
139− Color: stringPtr(dark.Sapphire().Hex),
140− Underline: boolPtr(true),
141− Format: "🖼 {{.text}}",
143− ImageText: ansi.StylePrimitive{
144− Color: stringPtr(dark.Pink().Hex),
145− Format: "{{.text}}",
147− Code: ansi.StyleBlock{
148− StylePrimitive: ansi.StylePrimitive{
149− Color: stringPtr(dark.Green().Hex),
154− CodeBlock: ansi.StyleCodeBlock{
155− StyleBlock: ansi.StyleBlock{
156 StylePrimitive: ansi.StylePrimitive{
33 StylePrimitive: ansi.StylePrimitive{
157− Prefix: " ",
34+ BlockPrefix: "",
158− Color: stringPtr(dark.Text().Hex),
35+ BlockSuffix: "",
36+ Color: stringPtr(adaptiveColorToString(t.MarkdownText())),
161 Margin: uintPtr(defaultMargin),
38 Margin: uintPtr(defaultMargin),
163− Chroma: &ansi.Chroma{
40+ BlockQuote: ansi.StyleBlock{
164− Text: ansi.StylePrimitive{
165− Color: stringPtr(dark.Text().Hex),
167− Error: ansi.StylePrimitive{
168− Color: stringPtr(dark.Text().Hex),
170− Comment: ansi.StylePrimitive{
171− Color: stringPtr(dark.Overlay1().Hex),
173− CommentPreproc: ansi.StylePrimitive{
174− Color: stringPtr(dark.Pink().Hex),
176− Keyword: ansi.StylePrimitive{
177− Color: stringPtr(dark.Pink().Hex),
179− KeywordReserved: ansi.StylePrimitive{
180− Color: stringPtr(dark.Pink().Hex),
182− KeywordNamespace: ansi.StylePrimitive{
183− Color: stringPtr(dark.Pink().Hex),
185− KeywordType: ansi.StylePrimitive{
186− Color: stringPtr(dark.Sky().Hex),
188− Operator: ansi.StylePrimitive{
189− Color: stringPtr(dark.Pink().Hex),
191− Punctuation: ansi.StylePrimitive{
192− Color: stringPtr(dark.Text().Hex),
194− Name: ansi.StylePrimitive{
195− Color: stringPtr(dark.Sky().Hex),
197− NameBuiltin: ansi.StylePrimitive{
198− Color: stringPtr(dark.Sky().Hex),
200− NameTag: ansi.StylePrimitive{
201− Color: stringPtr(dark.Pink().Hex),
203− NameAttribute: ansi.StylePrimitive{
204− Color: stringPtr(dark.Green().Hex),
206− NameClass: ansi.StylePrimitive{
207− Color: stringPtr(dark.Sky().Hex),
209− NameConstant: ansi.StylePrimitive{
210− Color: stringPtr(dark.Mauve().Hex),
212− NameDecorator: ansi.StylePrimitive{
213− Color: stringPtr(dark.Green().Hex),
215− NameFunction: ansi.StylePrimitive{
216− Color: stringPtr(dark.Green().Hex),
218− LiteralNumber: ansi.StylePrimitive{
219− Color: stringPtr(dark.Teal().Hex),
221− LiteralString: ansi.StylePrimitive{
222− Color: stringPtr(dark.Yellow().Hex),
224− LiteralStringEscape: ansi.StylePrimitive{
225− Color: stringPtr(dark.Pink().Hex),
227− GenericDeleted: ansi.StylePrimitive{
228− Color: stringPtr(dark.Red().Hex),
230− GenericEmph: ansi.StylePrimitive{
41+ StylePrimitive: ansi.StylePrimitive{
231− Color: stringPtr(dark.Yellow().Hex),
42+ Color: stringPtr(adaptiveColorToString(t.MarkdownBlockQuote())),
232 Italic: boolPtr(true),
43 Italic: boolPtr(true),
234− GenericInserted: ansi.StylePrimitive{
46+ Indent: uintPtr(1),
235− Color: stringPtr(dark.Green().Hex),
47+ IndentToken: stringPtr(BaseStyle().Render(" ")),
237− GenericStrong: ansi.StylePrimitive{
49+ List: ansi.StyleList{
238− Color: stringPtr(dark.Peach().Hex),
50+ LevelIndent: defaultMargin,
239− Bold: boolPtr(true),
51+ StyleBlock: ansi.StyleBlock{
240− },
52+ IndentToken: stringPtr(BaseStyle().Render(" ")),
241− GenericSubheading: ansi.StylePrimitive{
53+ StylePrimitive: ansi.StylePrimitive{
242− Color: stringPtr(dark.Mauve().Hex),
54+ Color: stringPtr(adaptiveColorToString(t.MarkdownText())),
246− Table: ansi.StyleTable{
247− StyleBlock: ansi.StyleBlock{
58+ Heading: ansi.StyleBlock{
248 StylePrimitive: ansi.StylePrimitive{
59 StylePrimitive: ansi.StylePrimitive{
250 BlockSuffix: "\n",
60 BlockSuffix: "\n",
61+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
253− CenterSeparator: stringPtr("┼"),
254− ColumnSeparator: stringPtr("│"),
255− RowSeparator: stringPtr("─"),
257− DefinitionDescription: ansi.StylePrimitive{
258− BlockPrefix: "\n ❯ ",
259− Color: stringPtr(dark.Sapphire().Hex),
263−var catppuccinLight = ansi.StyleConfig{
264− Document: ansi.StyleBlock{
265− StylePrimitive: ansi.StylePrimitive{
268− Color: stringPtr(light.Text().Hex),
270− Margin: uintPtr(defaultMargin),
272− BlockQuote: ansi.StyleBlock{
273− StylePrimitive: ansi.StylePrimitive{
274− Color: stringPtr(light.Yellow().Hex),
275− Italic: boolPtr(true),
279− Margin: uintPtr(defaultMargin),
281− List: ansi.StyleList{
282− LevelIndent: defaultMargin,
283− StyleBlock: ansi.StyleBlock{
65+ H1: ansi.StyleBlock{
284 StylePrimitive: ansi.StylePrimitive{
66 StylePrimitive: ansi.StylePrimitive{
285− Color: stringPtr(light.Text().Hex),
67+ Prefix: "# ",
68+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
289− Heading: ansi.StyleBlock{
290− StylePrimitive: ansi.StylePrimitive{
292− Color: stringPtr(light.Mauve().Hex),
293− Bold: boolPtr(true),
296− H1: ansi.StyleBlock{
297− StylePrimitive: ansi.StylePrimitive{
299− Color: stringPtr(light.Lavender().Hex),
300− Bold: boolPtr(true),
304− H2: ansi.StyleBlock{
305− StylePrimitive: ansi.StylePrimitive{
307− Color: stringPtr(light.Mauve().Hex),
308− Bold: boolPtr(true),
311− H3: ansi.StyleBlock{
312− StylePrimitive: ansi.StylePrimitive{
314− Color: stringPtr(light.Pink().Hex),
315− Bold: boolPtr(true),
318− H4: ansi.StyleBlock{
319− StylePrimitive: ansi.StylePrimitive{
321− Color: stringPtr(light.Flamingo().Hex),
322− Bold: boolPtr(true),
325− H5: ansi.StyleBlock{
326− StylePrimitive: ansi.StylePrimitive{
328− Color: stringPtr(light.Rosewater().Hex),
329− Bold: boolPtr(true),
332− H6: ansi.StyleBlock{
333− StylePrimitive: ansi.StylePrimitive{
335− Color: stringPtr(light.Rosewater().Hex),
336− Bold: boolPtr(true),
339− Strikethrough: ansi.StylePrimitive{
340− CrossedOut: boolPtr(true),
341− Color: stringPtr(light.Overlay1().Hex),
343− Emph: ansi.StylePrimitive{
344− Color: stringPtr(light.Yellow().Hex),
345− Italic: boolPtr(true),
347− Strong: ansi.StylePrimitive{
348− Bold: boolPtr(true),
349− Color: stringPtr(light.Peach().Hex),
351− HorizontalRule: ansi.StylePrimitive{
352− Color: stringPtr(light.Overlay0().Hex),
353− Format: "\n─────────────────────────────────────────\n",
355− Item: ansi.StylePrimitive{
357− Color: stringPtr(light.Blue().Hex),
359− Enumeration: ansi.StylePrimitive{
361− Color: stringPtr(light.Sky().Hex),
363− Task: ansi.StyleTask{
364− StylePrimitive: ansi.StylePrimitive{},
368− Link: ansi.StylePrimitive{
369− Color: stringPtr(light.Sky().Hex),
370− Underline: boolPtr(true),
372− LinkText: ansi.StylePrimitive{
373− Color: stringPtr(light.Pink().Hex),
374− Bold: boolPtr(true),
376− Image: ansi.StylePrimitive{
377− Color: stringPtr(light.Sapphire().Hex),
378− Underline: boolPtr(true),
379− Format: "🖼 {{.text}}",
381− ImageText: ansi.StylePrimitive{
382− Color: stringPtr(light.Pink().Hex),
383− Format: "{{.text}}",
385− Code: ansi.StyleBlock{
386− StylePrimitive: ansi.StylePrimitive{
387− Color: stringPtr(light.Green().Hex),
392− CodeBlock: ansi.StyleCodeBlock{
393− StyleBlock: ansi.StyleBlock{
72+ H2: ansi.StyleBlock{
394 StylePrimitive: ansi.StylePrimitive{
73 StylePrimitive: ansi.StylePrimitive{
395− Prefix: " ",
74+ Prefix: "## ",
396− Color: stringPtr(light.Text().Hex),
75+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
399− Margin: uintPtr(defaultMargin),
401− Chroma: &ansi.Chroma{
402− Text: ansi.StylePrimitive{
403− Color: stringPtr(light.Text().Hex),
405− Error: ansi.StylePrimitive{
406− Color: stringPtr(light.Text().Hex),
408− Comment: ansi.StylePrimitive{
409− Color: stringPtr(light.Overlay1().Hex),
411− CommentPreproc: ansi.StylePrimitive{
412− Color: stringPtr(light.Pink().Hex),
414− Keyword: ansi.StylePrimitive{
415− Color: stringPtr(light.Pink().Hex),
417− KeywordReserved: ansi.StylePrimitive{
418− Color: stringPtr(light.Pink().Hex),
420− KeywordNamespace: ansi.StylePrimitive{
421− Color: stringPtr(light.Pink().Hex),
423− KeywordType: ansi.StylePrimitive{
424− Color: stringPtr(light.Sky().Hex),
426− Operator: ansi.StylePrimitive{
427− Color: stringPtr(light.Pink().Hex),
429− Punctuation: ansi.StylePrimitive{
430− Color: stringPtr(light.Text().Hex),
432− Name: ansi.StylePrimitive{
433− Color: stringPtr(light.Sky().Hex),
435− NameBuiltin: ansi.StylePrimitive{
436− Color: stringPtr(light.Sky().Hex),
438− NameTag: ansi.StylePrimitive{
439− Color: stringPtr(light.Pink().Hex),
441− NameAttribute: ansi.StylePrimitive{
442− Color: stringPtr(light.Green().Hex),
444− NameClass: ansi.StylePrimitive{
445− Color: stringPtr(light.Sky().Hex),
447− NameConstant: ansi.StylePrimitive{
448− Color: stringPtr(light.Mauve().Hex),
450− NameDecorator: ansi.StylePrimitive{
451− Color: stringPtr(light.Green().Hex),
453− NameFunction: ansi.StylePrimitive{
454− Color: stringPtr(light.Green().Hex),
456− LiteralNumber: ansi.StylePrimitive{
457− Color: stringPtr(light.Teal().Hex),
459− LiteralString: ansi.StylePrimitive{
460− Color: stringPtr(light.Yellow().Hex),
462− LiteralStringEscape: ansi.StylePrimitive{
463− Color: stringPtr(light.Pink().Hex),
465− GenericDeleted: ansi.StylePrimitive{
466− Color: stringPtr(light.Red().Hex),
468− GenericEmph: ansi.StylePrimitive{
469− Color: stringPtr(light.Yellow().Hex),
470− Italic: boolPtr(true),
472− GenericInserted: ansi.StylePrimitive{
473− Color: stringPtr(light.Green().Hex),
475− GenericStrong: ansi.StylePrimitive{
476− Color: stringPtr(light.Peach().Hex),
477− Bold: boolPtr(true),
479− GenericSubheading: ansi.StylePrimitive{
480− Color: stringPtr(light.Mauve().Hex),
484− Table: ansi.StyleTable{
485− StyleBlock: ansi.StyleBlock{
79+ H3: ansi.StyleBlock{
486 StylePrimitive: ansi.StylePrimitive{
80 StylePrimitive: ansi.StylePrimitive{
487− BlockPrefix: "\n",
81+ Prefix: "### ",
488− BlockSuffix: "\n",
82+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
491− CenterSeparator: stringPtr("┼"),
492− ColumnSeparator: stringPtr("│"),
493− RowSeparator: stringPtr("─"),
495− DefinitionDescription: ansi.StylePrimitive{
496− BlockPrefix: "\n ❯ ",
497− Color: stringPtr(light.Sapphire().Hex),
501−func MarkdownTheme(focused bool) ansi.StyleConfig {
503− return ASCIIStyleConfig
505− return DraculaStyleConfig
510− defaultListIndent = 2
511− defaultListLevelIndent = 4
514−var ASCIIStyleConfig = ansi.StyleConfig{
515− Document: ansi.StyleBlock{
516− StylePrimitive: ansi.StylePrimitive{
517− BackgroundColor: stringPtr(Background.Dark),
518− Color: stringPtr(ForgroundDim.Dark),
521− IndentToken: stringPtr(BaseStyle.Render(" ")),
523− BlockQuote: ansi.StyleBlock{
524− StylePrimitive: ansi.StylePrimitive{
525− BackgroundColor: stringPtr(Background.Dark),
528− IndentToken: stringPtr("| "),
530− Paragraph: ansi.StyleBlock{
531− StylePrimitive: ansi.StylePrimitive{
532− BackgroundColor: stringPtr(Background.Dark),
535− List: ansi.StyleList{
536− StyleBlock: ansi.StyleBlock{
86+ H4: ansi.StyleBlock{
537− IndentToken: stringPtr(BaseStyle.Render(" ")),
538 StylePrimitive: ansi.StylePrimitive{
87 StylePrimitive: ansi.StylePrimitive{
539− BackgroundColor: stringPtr(Background.Dark),
88+ Prefix: "#### ",
89+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
542− LevelIndent: defaultListLevelIndent,
544− Heading: ansi.StyleBlock{
545− StylePrimitive: ansi.StylePrimitive{
546− BackgroundColor: stringPtr(Background.Dark),
550− H1: ansi.StyleBlock{
551− StylePrimitive: ansi.StylePrimitive{
552− BackgroundColor: stringPtr(Background.Dark),
556− H2: ansi.StyleBlock{
557− StylePrimitive: ansi.StylePrimitive{
558− BackgroundColor: stringPtr(Background.Dark),
562− H3: ansi.StyleBlock{
563− StylePrimitive: ansi.StylePrimitive{
564− BackgroundColor: stringPtr(Background.Dark),
568− H4: ansi.StyleBlock{
569− StylePrimitive: ansi.StylePrimitive{
570− BackgroundColor: stringPtr(Background.Dark),
574− H5: ansi.StyleBlock{
575− StylePrimitive: ansi.StylePrimitive{
576− BackgroundColor: stringPtr(Background.Dark),
580− H6: ansi.StyleBlock{
581− StylePrimitive: ansi.StylePrimitive{
582− BackgroundColor: stringPtr(Background.Dark),
586− Strikethrough: ansi.StylePrimitive{
587− BackgroundColor: stringPtr(Background.Dark),
591− Emph: ansi.StylePrimitive{
592− BackgroundColor: stringPtr(Background.Dark),
596− Strong: ansi.StylePrimitive{
597− BackgroundColor: stringPtr(Background.Dark),
601− HorizontalRule: ansi.StylePrimitive{
602− BackgroundColor: stringPtr(Background.Dark),
603− Format: "\n--------\n",
605− Item: ansi.StylePrimitive{
607− BackgroundColor: stringPtr(Background.Dark),
609− Enumeration: ansi.StylePrimitive{
611− BackgroundColor: stringPtr(Background.Dark),
613− Task: ansi.StyleTask{
616− StylePrimitive: ansi.StylePrimitive{
617− BackgroundColor: stringPtr(Background.Dark),
620− ImageText: ansi.StylePrimitive{
621− BackgroundColor: stringPtr(Background.Dark),
622− Format: "Image: {{.text}} →",
624− Code: ansi.StyleBlock{
625− StylePrimitive: ansi.StylePrimitive{
628− BackgroundColor: stringPtr(Background.Dark),
631− CodeBlock: ansi.StyleCodeBlock{
632− StyleBlock: ansi.StyleBlock{
93+ H5: ansi.StyleBlock{
633 StylePrimitive: ansi.StylePrimitive{
94 StylePrimitive: ansi.StylePrimitive{
634− BackgroundColor: stringPtr(Background.Dark),
95+ Prefix: "##### ",
96+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
636− Margin: uintPtr(defaultMargin),
639− Table: ansi.StyleTable{
640− StyleBlock: ansi.StyleBlock{
100+ H6: ansi.StyleBlock{
641 StylePrimitive: ansi.StylePrimitive{
101 StylePrimitive: ansi.StylePrimitive{
642− BackgroundColor: stringPtr(Background.Dark),
102+ Prefix: "###### ",
103+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
104+ Bold: boolPtr(true),
644− IndentToken: stringPtr(BaseStyle.Render(" ")),
646− CenterSeparator: stringPtr("|"),
647− ColumnSeparator: stringPtr("|"),
648− RowSeparator: stringPtr("-"),
650− DefinitionDescription: ansi.StylePrimitive{
651− BackgroundColor: stringPtr(Background.Dark),
652− BlockPrefix: "\n* ",
656−var DraculaStyleConfig = ansi.StyleConfig{
657− Document: ansi.StyleBlock{
658− StylePrimitive: ansi.StylePrimitive{
659− Color: stringPtr(Forground.Dark),
660− BackgroundColor: stringPtr(Background.Dark),
662− Indent: uintPtr(defaultMargin),
663− IndentToken: stringPtr(BaseStyle.Render(" ")),
665− BlockQuote: ansi.StyleBlock{
666− StylePrimitive: ansi.StylePrimitive{
667− Color: stringPtr("#f1fa8c"),
668− Italic: boolPtr(true),
669− BackgroundColor: stringPtr(Background.Dark),
671− Indent: uintPtr(defaultMargin),
107+ Strikethrough: ansi.StylePrimitive{
672− IndentToken: stringPtr(BaseStyle.Render(" ")),
108+ CrossedOut: boolPtr(true),
673− },
109+ Color: stringPtr(adaptiveColorToString(t.TextMuted())),
674− Paragraph: ansi.StyleBlock{
675− StylePrimitive: ansi.StylePrimitive{
676− BackgroundColor: stringPtr(Background.Dark),
678− },
111+ Emph: ansi.StylePrimitive{
679− List: ansi.StyleList{
112+ Color: stringPtr(adaptiveColorToString(t.MarkdownEmph())),
680− LevelIndent: defaultMargin,
113+ Italic: boolPtr(true),
681− StyleBlock: ansi.StyleBlock{
682− IndentToken: stringPtr(BaseStyle.Render(" ")),
683− StylePrimitive: ansi.StylePrimitive{
684− Color: stringPtr(Forground.Dark),
685− BackgroundColor: stringPtr(Background.Dark),
689− Heading: ansi.StyleBlock{
690− StylePrimitive: ansi.StylePrimitive{
115+ Strong: ansi.StylePrimitive{
692− Color: stringPtr(PrimaryColor.Dark),
693− Bold: boolPtr(true),
116+ Bold: boolPtr(true),
694− BackgroundColor: stringPtr(Background.Dark),
117+ Color: stringPtr(adaptiveColorToString(t.MarkdownStrong())),
697− H1: ansi.StyleBlock{
698− StylePrimitive: ansi.StylePrimitive{
119+ HorizontalRule: ansi.StylePrimitive{
699− Prefix: "# ",
120+ Color: stringPtr(adaptiveColorToString(t.MarkdownHorizontalRule())),
700− BackgroundColor: stringPtr(Background.Dark),
121+ Format: "\n─────────────────────────────────────────\n",
703− H2: ansi.StyleBlock{
704− StylePrimitive: ansi.StylePrimitive{
123+ Item: ansi.StylePrimitive{
705− Prefix: "## ",
124+ BlockPrefix: "• ",
706− BackgroundColor: stringPtr(Background.Dark),
125+ Color: stringPtr(adaptiveColorToString(t.MarkdownListItem())),
709− H3: ansi.StyleBlock{
710− StylePrimitive: ansi.StylePrimitive{
127+ Enumeration: ansi.StylePrimitive{
711− Prefix: "### ",
128+ BlockPrefix: ". ",
712− BackgroundColor: stringPtr(Background.Dark),
129+ Color: stringPtr(adaptiveColorToString(t.MarkdownListEnumeration())),
714− },
131+ Task: ansi.StyleTask{
715− H4: ansi.StyleBlock{
716− StylePrimitive: ansi.StylePrimitive{
132+ StylePrimitive: ansi.StylePrimitive{},
717− Prefix: "#### ",
133+ Ticked: "[✓] ",
718− BackgroundColor: stringPtr(Background.Dark),
134+ Unticked: "[ ] ",
721− H5: ansi.StyleBlock{
722− StylePrimitive: ansi.StylePrimitive{
136+ Link: ansi.StylePrimitive{
723− Prefix: "##### ",
137+ Color: stringPtr(adaptiveColorToString(t.MarkdownLink())),
724− BackgroundColor: stringPtr(Background.Dark),
138+ Underline: boolPtr(true),
727− H6: ansi.StyleBlock{
728− StylePrimitive: ansi.StylePrimitive{
140+ LinkText: ansi.StylePrimitive{
729− Prefix: "###### ",
141+ Color: stringPtr(adaptiveColorToString(t.MarkdownLinkText())),
730− BackgroundColor: stringPtr(Background.Dark),
142+ Bold: boolPtr(true),
733− Strikethrough: ansi.StylePrimitive{
734− CrossedOut: boolPtr(true),
735− BackgroundColor: stringPtr(Background.Dark),
737− Emph: ansi.StylePrimitive{
144+ Image: ansi.StylePrimitive{
738− Color: stringPtr("#f1fa8c"),
145+ Color: stringPtr(adaptiveColorToString(t.MarkdownImage())),
739− Italic: boolPtr(true),
146+ Underline: boolPtr(true),
740− BackgroundColor: stringPtr(Background.Dark),
742− Strong: ansi.StylePrimitive{
743− Bold: boolPtr(true),
744− Color: stringPtr(Blue.Dark),
745− BackgroundColor: stringPtr(Background.Dark),
747− HorizontalRule: ansi.StylePrimitive{
748− Color: stringPtr("#6272A4"),
749− Format: "\n--------\n",
147+ Format: "🖼 {{.text}}",
750− BackgroundColor: stringPtr(Background.Dark),
752− Item: ansi.StylePrimitive{
754− BackgroundColor: stringPtr(Background.Dark),
756− Enumeration: ansi.StylePrimitive{
758− Color: stringPtr("#8be9fd"),
759− BackgroundColor: stringPtr(Background.Dark),
761− Task: ansi.StyleTask{
762− StylePrimitive: ansi.StylePrimitive{
763− BackgroundColor: stringPtr(Background.Dark),
768− Link: ansi.StylePrimitive{
769− Color: stringPtr("#8be9fd"),
770− Underline: boolPtr(true),
771− BackgroundColor: stringPtr(Background.Dark),
773− LinkText: ansi.StylePrimitive{
774− Color: stringPtr("#ff79c6"),
775− BackgroundColor: stringPtr(Background.Dark),
777− Image: ansi.StylePrimitive{
778− Color: stringPtr("#8be9fd"),
779− Underline: boolPtr(true),
780− BackgroundColor: stringPtr(Background.Dark),
782− ImageText: ansi.StylePrimitive{
149+ ImageText: ansi.StylePrimitive{
783− Color: stringPtr("#ff79c6"),
150+ Color: stringPtr(adaptiveColorToString(t.MarkdownImageText())),
784− Format: "Image: {{.text}} →",
151+ Format: "{{.text}}",
785− BackgroundColor: stringPtr(Background.Dark),
787− Code: ansi.StyleBlock{
788− StylePrimitive: ansi.StylePrimitive{
789− Color: stringPtr("#50fa7b"),
790− BackgroundColor: stringPtr(Background.Dark),
793− Text: ansi.StylePrimitive{
794− BackgroundColor: stringPtr(Background.Dark),
796− DefinitionList: ansi.StyleBlock{},
797− CodeBlock: ansi.StyleCodeBlock{
798− StyleBlock: ansi.StyleBlock{
153+ Code: ansi.StyleBlock{
799 StylePrimitive: ansi.StylePrimitive{
154 StylePrimitive: ansi.StylePrimitive{
800− Color: stringPtr(Blue.Dark),
155+ Color: stringPtr(adaptiveColorToString(t.MarkdownCode())),
801− BackgroundColor: stringPtr(Background.Dark),
156+ Prefix: "",
160+ CodeBlock: ansi.StyleCodeBlock{
161+ StyleBlock: ansi.StyleBlock{
162+ StylePrimitive: ansi.StylePrimitive{
164+ Color: stringPtr(adaptiveColorToString(t.MarkdownCodeBlock())),
803− Margin: uintPtr(defaultMargin),
166+ Margin: uintPtr(defaultMargin),
805− Chroma: &ansi.Chroma{
168+ Chroma: &ansi.Chroma{
806− NameOther: ansi.StylePrimitive{
169+ Text: ansi.StylePrimitive{
807− BackgroundColor: stringPtr(Background.Dark),
170+ Color: stringPtr(adaptiveColorToString(t.MarkdownText())),
809− Literal: ansi.StylePrimitive{
810− BackgroundColor: stringPtr(Background.Dark),
812− NameException: ansi.StylePrimitive{
813− BackgroundColor: stringPtr(Background.Dark),
815− LiteralDate: ansi.StylePrimitive{
816− BackgroundColor: stringPtr(Background.Dark),
818− Text: ansi.StylePrimitive{
172+ Error: ansi.StylePrimitive{
819− Color: stringPtr(Forground.Dark),
173+ Color: stringPtr(adaptiveColorToString(t.Error())),
820− BackgroundColor: stringPtr(Background.Dark),
822− Error: ansi.StylePrimitive{
823− Color: stringPtr("#f8f8f2"),
824− BackgroundColor: stringPtr("#ff5555"),
826− Comment: ansi.StylePrimitive{
175+ Comment: ansi.StylePrimitive{
827− Color: stringPtr("#6272A4"),
176+ Color: stringPtr(adaptiveColorToString(t.SyntaxComment())),
828− BackgroundColor: stringPtr(Background.Dark),
830− CommentPreproc: ansi.StylePrimitive{
178+ CommentPreproc: ansi.StylePrimitive{
831− Color: stringPtr("#ff79c6"),
179+ Color: stringPtr(adaptiveColorToString(t.SyntaxKeyword())),
832− BackgroundColor: stringPtr(Background.Dark),
834− Keyword: ansi.StylePrimitive{
181+ Keyword: ansi.StylePrimitive{
835− Color: stringPtr("#ff79c6"),
182+ Color: stringPtr(adaptiveColorToString(t.SyntaxKeyword())),
836− BackgroundColor: stringPtr(Background.Dark),
838− KeywordReserved: ansi.StylePrimitive{
184+ KeywordReserved: ansi.StylePrimitive{
839− Color: stringPtr("#ff79c6"),
185+ Color: stringPtr(adaptiveColorToString(t.SyntaxKeyword())),
840− BackgroundColor: stringPtr(Background.Dark),
842− KeywordNamespace: ansi.StylePrimitive{
187+ KeywordNamespace: ansi.StylePrimitive{
843− Color: stringPtr("#ff79c6"),
188+ Color: stringPtr(adaptiveColorToString(t.SyntaxKeyword())),
844− BackgroundColor: stringPtr(Background.Dark),
846− KeywordType: ansi.StylePrimitive{
190+ KeywordType: ansi.StylePrimitive{
847− Color: stringPtr("#8be9fd"),
191+ Color: stringPtr(adaptiveColorToString(t.SyntaxType())),
848− BackgroundColor: stringPtr(Background.Dark),
850− Operator: ansi.StylePrimitive{
193+ Operator: ansi.StylePrimitive{
851− Color: stringPtr("#ff79c6"),
194+ Color: stringPtr(adaptiveColorToString(t.SyntaxOperator())),
852− BackgroundColor: stringPtr(Background.Dark),
854− Punctuation: ansi.StylePrimitive{
196+ Punctuation: ansi.StylePrimitive{
855− Color: stringPtr(Forground.Dark),
197+ Color: stringPtr(adaptiveColorToString(t.SyntaxPunctuation())),
856− BackgroundColor: stringPtr(Background.Dark),
858− Name: ansi.StylePrimitive{
199+ Name: ansi.StylePrimitive{
859− Color: stringPtr("#8be9fd"),
200+ Color: stringPtr(adaptiveColorToString(t.SyntaxVariable())),
860− BackgroundColor: stringPtr(Background.Dark),
862− NameBuiltin: ansi.StylePrimitive{
202+ NameBuiltin: ansi.StylePrimitive{
863− Color: stringPtr("#8be9fd"),
203+ Color: stringPtr(adaptiveColorToString(t.SyntaxVariable())),
864− BackgroundColor: stringPtr(Background.Dark),
866− NameTag: ansi.StylePrimitive{
205+ NameTag: ansi.StylePrimitive{
867− Color: stringPtr("#ff79c6"),
206+ Color: stringPtr(adaptiveColorToString(t.SyntaxKeyword())),
868− BackgroundColor: stringPtr(Background.Dark),
870− NameAttribute: ansi.StylePrimitive{
208+ NameAttribute: ansi.StylePrimitive{
871− Color: stringPtr("#50fa7b"),
209+ Color: stringPtr(adaptiveColorToString(t.SyntaxFunction())),
872− BackgroundColor: stringPtr(Background.Dark),
874− NameClass: ansi.StylePrimitive{
211+ NameClass: ansi.StylePrimitive{
875− Color: stringPtr("#8be9fd"),
212+ Color: stringPtr(adaptiveColorToString(t.SyntaxType())),
876− BackgroundColor: stringPtr(Background.Dark),
878− NameConstant: ansi.StylePrimitive{
214+ NameConstant: ansi.StylePrimitive{
879− Color: stringPtr("#bd93f9"),
215+ Color: stringPtr(adaptiveColorToString(t.SyntaxVariable())),
880− BackgroundColor: stringPtr(Background.Dark),
882− NameDecorator: ansi.StylePrimitive{
217+ NameDecorator: ansi.StylePrimitive{
883− Color: stringPtr("#50fa7b"),
218+ Color: stringPtr(adaptiveColorToString(t.SyntaxFunction())),
884− BackgroundColor: stringPtr(Background.Dark),
886− NameFunction: ansi.StylePrimitive{
220+ NameFunction: ansi.StylePrimitive{
887− Color: stringPtr("#50fa7b"),
221+ Color: stringPtr(adaptiveColorToString(t.SyntaxFunction())),
888− BackgroundColor: stringPtr(Background.Dark),
890− LiteralNumber: ansi.StylePrimitive{
223+ LiteralNumber: ansi.StylePrimitive{
891− Color: stringPtr("#6EEFC0"),
224+ Color: stringPtr(adaptiveColorToString(t.SyntaxNumber())),
892− BackgroundColor: stringPtr(Background.Dark),
894− LiteralString: ansi.StylePrimitive{
226+ LiteralString: ansi.StylePrimitive{
895− Color: stringPtr("#f1fa8c"),
227+ Color: stringPtr(adaptiveColorToString(t.SyntaxString())),
896− BackgroundColor: stringPtr(Background.Dark),
898− LiteralStringEscape: ansi.StylePrimitive{
229+ LiteralStringEscape: ansi.StylePrimitive{
899− Color: stringPtr("#ff79c6"),
230+ Color: stringPtr(adaptiveColorToString(t.SyntaxKeyword())),
900− BackgroundColor: stringPtr(Background.Dark),
902− GenericDeleted: ansi.StylePrimitive{
232+ GenericDeleted: ansi.StylePrimitive{
903− Color: stringPtr("#ff5555"),
233+ Color: stringPtr(adaptiveColorToString(t.DiffRemoved())),
904− BackgroundColor: stringPtr(Background.Dark),
906− GenericEmph: ansi.StylePrimitive{
235+ GenericEmph: ansi.StylePrimitive{
907− Color: stringPtr("#f1fa8c"),
236+ Color: stringPtr(adaptiveColorToString(t.MarkdownEmph())),
908− Italic: boolPtr(true),
237+ Italic: boolPtr(true),
909− BackgroundColor: stringPtr(Background.Dark),
911− GenericInserted: ansi.StylePrimitive{
239+ GenericInserted: ansi.StylePrimitive{
912− Color: stringPtr("#50fa7b"),
240+ Color: stringPtr(adaptiveColorToString(t.DiffAdded())),
913− BackgroundColor: stringPtr(Background.Dark),
915− GenericStrong: ansi.StylePrimitive{
242+ GenericStrong: ansi.StylePrimitive{
916− Color: stringPtr("#ffb86c"),
243+ Color: stringPtr(adaptiveColorToString(t.MarkdownStrong())),
917− Bold: boolPtr(true),
244+ Bold: boolPtr(true),
918− BackgroundColor: stringPtr(Background.Dark),
920− GenericSubheading: ansi.StylePrimitive{
246+ GenericSubheading: ansi.StylePrimitive{
921− Color: stringPtr("#bd93f9"),
247+ Color: stringPtr(adaptiveColorToString(t.MarkdownHeading())),
922− BackgroundColor: stringPtr(Background.Dark),
248+ },
924− Background: ansi.StylePrimitive{
925− BackgroundColor: stringPtr(Background.Dark),
929− Table: ansi.StyleTable{
251+ Table: ansi.StyleTable{
930− StyleBlock: ansi.StyleBlock{
252+ StyleBlock: ansi.StyleBlock{
253+ StylePrimitive: ansi.StylePrimitive{
258+ CenterSeparator: stringPtr("┼"),
259+ ColumnSeparator: stringPtr("│"),
260+ RowSeparator: stringPtr("─"),
262+ DefinitionDescription: ansi.StylePrimitive{
263+ BlockPrefix: "\n ❯ ",
264+ Color: stringPtr(adaptiveColorToString(t.MarkdownLinkText())),
266+ Text: ansi.StylePrimitive{
267+ Color: stringPtr(adaptiveColorToString(t.MarkdownText())),
269+ Paragraph: ansi.StyleBlock{
931 StylePrimitive: ansi.StylePrimitive{
270 StylePrimitive: ansi.StylePrimitive{
932− BackgroundColor: stringPtr(Background.Dark),
271+ Color: stringPtr(adaptiveColorToString(t.MarkdownText())),
934− IndentToken: stringPtr(BaseStyle.Render(" ")),
937− DefinitionDescription: ansi.StylePrimitive{
275+}
938− BlockPrefix: "\n* ",
276+
939− BackgroundColor: stringPtr(Background.Dark),
277+// adaptiveColorToString converts a lipgloss.AdaptiveColor to the appropriate
278+// hex color string based on the current terminal background
279+func adaptiveColorToString(color lipgloss.AdaptiveColor) string {
280+ if lipgloss.HasDarkBackground() {