4 "github.com/alecthomas/chroma/v2"
5 "github.com/charmbracelet/glamour/v2/ansi"
8func chromaStyle(style ansi.StylePrimitive) string {
11 if style.Color != nil {
14 if style.BackgroundColor != nil {
18 s += "bg:" + *style.BackgroundColor
20 if style.Italic != nil && *style.Italic {
26 if style.Bold != nil && *style.Bold {
32 if style.Underline != nil && *style.Underline {
42func GetChromaTheme() chroma.StyleEntries {
44 rules := t.S().Markdown.CodeBlock
46 return chroma.StyleEntries{
47 chroma.Text: chromaStyle(rules.Chroma.Text),
48 chroma.Error: chromaStyle(rules.Chroma.Error),
49 chroma.Comment: chromaStyle(rules.Chroma.Comment),
50 chroma.CommentPreproc: chromaStyle(rules.Chroma.CommentPreproc),
51 chroma.Keyword: chromaStyle(rules.Chroma.Keyword),
52 chroma.KeywordReserved: chromaStyle(rules.Chroma.KeywordReserved),
53 chroma.KeywordNamespace: chromaStyle(rules.Chroma.KeywordNamespace),
54 chroma.KeywordType: chromaStyle(rules.Chroma.KeywordType),
55 chroma.Operator: chromaStyle(rules.Chroma.Operator),
56 chroma.Punctuation: chromaStyle(rules.Chroma.Punctuation),
57 chroma.Name: chromaStyle(rules.Chroma.Name),
58 chroma.NameBuiltin: chromaStyle(rules.Chroma.NameBuiltin),
59 chroma.NameTag: chromaStyle(rules.Chroma.NameTag),
60 chroma.NameAttribute: chromaStyle(rules.Chroma.NameAttribute),
61 chroma.NameClass: chromaStyle(rules.Chroma.NameClass),
62 chroma.NameConstant: chromaStyle(rules.Chroma.NameConstant),
63 chroma.NameDecorator: chromaStyle(rules.Chroma.NameDecorator),
64 chroma.NameException: chromaStyle(rules.Chroma.NameException),
65 chroma.NameFunction: chromaStyle(rules.Chroma.NameFunction),
66 chroma.NameOther: chromaStyle(rules.Chroma.NameOther),
67 chroma.Literal: chromaStyle(rules.Chroma.Literal),
68 chroma.LiteralNumber: chromaStyle(rules.Chroma.LiteralNumber),
69 chroma.LiteralDate: chromaStyle(rules.Chroma.LiteralDate),
70 chroma.LiteralString: chromaStyle(rules.Chroma.LiteralString),
71 chroma.LiteralStringEscape: chromaStyle(rules.Chroma.LiteralStringEscape),
72 chroma.GenericDeleted: chromaStyle(rules.Chroma.GenericDeleted),
73 chroma.GenericEmph: chromaStyle(rules.Chroma.GenericEmph),
74 chroma.GenericInserted: chromaStyle(rules.Chroma.GenericInserted),
75 chroma.GenericStrong: chromaStyle(rules.Chroma.GenericStrong),
76 chroma.GenericSubheading: chromaStyle(rules.Chroma.GenericSubheading),
77 chroma.Background: chromaStyle(rules.Chroma.Background),
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list