mirror of
https://github.com/rwinkhart/MUTN.git
synced 2026-09-05 00:27:15 -04:00
Lay groundwork for multiple color-scheme support
This commit is contained in:
@@ -46,7 +46,7 @@ func EntryReader(decryptedEntry []string, hidePassword bool, sync bool) {
|
|||||||
for field := 3; field < len(decryptedEntry); field++ {
|
for field := 3; field < len(decryptedEntry); field++ {
|
||||||
markdownNotes = append(markdownNotes, decryptedEntry[field])
|
markdownNotes = append(markdownNotes, decryptedEntry[field])
|
||||||
}
|
}
|
||||||
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
|
r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle("gruvbox")), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width))
|
||||||
markdownNotesString, _ := r.Render(strings.Join(markdownNotes, "\n"))
|
markdownNotesString, _ := r.Render(strings.Join(markdownNotes, "\n"))
|
||||||
|
|
||||||
// print markdown-rendered notes
|
// print markdown-rendered notes
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
func glamourStyle() []byte {
|
func glamourStyle(styleName string) []byte {
|
||||||
return []byte(`{
|
if styleName == "custom" {
|
||||||
|
return []byte(`{}`) // TODO add support for custom color schemes
|
||||||
|
} else if styleName == "gruvbox" {
|
||||||
|
return []byte(`{
|
||||||
"document": {
|
"document": {
|
||||||
"block_prefix": "\n",
|
"block_prefix": "\n",
|
||||||
"block_suffix": "\n",
|
"block_suffix": "\n",
|
||||||
@@ -198,4 +201,7 @@ func glamourStyle() []byte {
|
|||||||
"html_span": {}
|
"html_span": {}
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
} else {
|
||||||
|
return []byte(`{}`) // TODO add Go color scheme
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user