Let user pick a syntax color theme in Gold's style config

This commit is contained in:
Christian Muehlhaeuser
2019-11-25 06:02:50 +01:00
parent e6a9122041
commit 937e525993
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -427,7 +427,14 @@ func (tr *TermRenderer) RenderNode(w io.Writer, node *bf.Node, entering bool) bf
for _, f := range e.Fragments {
if node.Type == bf.CodeBlock {
err := quick.Highlight(w, f.Token, string(node.CodeBlockData.Info), "terminal16m", "monokai")
theme := "monokai"
if rules, ok := tr.style[f.Style]; ok {
if len(rules.Theme) > 0 {
theme = rules.Theme
}
}
err := quick.Highlight(w, f.Token, string(node.CodeBlockData.Info), "terminal16m", theme)
if err == nil {
continue
}
+1
View File
@@ -46,6 +46,7 @@ type ElementStyle struct {
Overlined bool `json:"overlined"`
Inverse bool `json:"inverse"`
Blink bool `json:"blink"`
Theme string `json:"theme"`
}
func keyToType(key string) (StyleType, error) {