diff --git a/cmd/gold/dark.json b/cmd/gold/dark.json index f876eb6..b853212 100644 --- a/cmd/gold/dark.json +++ b/cmd/gold/dark.json @@ -18,7 +18,8 @@ "color": "200" }, "code_block": { - "color": "200" + "color": "200", + "theme": "solarized-dark" }, "emph": { "italic": true diff --git a/gold.go b/gold.go index d766264..61a5384 100644 --- a/gold.go +++ b/gold.go @@ -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 } diff --git a/style.go b/style.go index 0a951ba..3afe646 100644 --- a/style.go +++ b/style.go @@ -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) {