Add custom theming
This commit is contained in:
@@ -124,43 +124,30 @@ func editorMarkdownStyleStart(style editorMarkdownStyle) string {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
if currentThemeName == "light" {
|
||||
switch style {
|
||||
case editorMarkdownHeading:
|
||||
return "\x1b[1;38;2;154;103;0m"
|
||||
case editorMarkdownStrong:
|
||||
return "\x1b[1;38;2;130;80;223m"
|
||||
case editorMarkdownEmphasis:
|
||||
return "\x1b[3;38;2;87;96;106m"
|
||||
case editorMarkdownCode:
|
||||
return "\x1b[38;2;17;99;41m"
|
||||
case editorMarkdownLink:
|
||||
return "\x1b[4;38;2;9;105;218m"
|
||||
case editorMarkdownDestination:
|
||||
return "\x1b[38;2;10;112;111m"
|
||||
case editorMarkdownQuote:
|
||||
return "\x1b[38;2;154;103;0m"
|
||||
case editorMarkdownComment:
|
||||
return "\x1b[2;38;2;101;109;118m"
|
||||
authors := editorMarkdownTheme.AuthorPalette
|
||||
author := func(index int) string {
|
||||
if len(authors) == 0 {
|
||||
return editorMarkdownTheme.Text
|
||||
}
|
||||
return authors[index%len(authors)]
|
||||
}
|
||||
switch style {
|
||||
case editorMarkdownHeading:
|
||||
return "\x1b[1;38;2;240;183;47m"
|
||||
return "\x1b[1m" + foregroundSequence(editorMarkdownTheme.Title)
|
||||
case editorMarkdownStrong:
|
||||
return "\x1b[1;38;2;198;120;221m"
|
||||
return "\x1b[1m" + foregroundSequence(author(1))
|
||||
case editorMarkdownEmphasis:
|
||||
return "\x1b[3;38;2;215;218;232m"
|
||||
return "\x1b[3m" + foregroundSequence(editorMarkdownTheme.Text)
|
||||
case editorMarkdownCode:
|
||||
return "\x1b[38;2;152;195;121m"
|
||||
return foregroundSequence(editorMarkdownTheme.Success)
|
||||
case editorMarkdownLink:
|
||||
return "\x1b[4;38;2;97;175;239m"
|
||||
return "\x1b[4m" + foregroundSequence(author(0))
|
||||
case editorMarkdownDestination:
|
||||
return "\x1b[38;2;86;182;194m"
|
||||
return foregroundSequence(author(2))
|
||||
case editorMarkdownQuote:
|
||||
return "\x1b[38;2;229;192;123m"
|
||||
return foregroundSequence(editorMarkdownTheme.Warning)
|
||||
case editorMarkdownComment:
|
||||
return "\x1b[2;38;2;119;119;119m"
|
||||
return "\x1b[2m" + foregroundSequence(editorMarkdownTheme.Dim)
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
@@ -168,15 +155,8 @@ func editorMarkdownStyleStart(style editorMarkdownStyle) string {
|
||||
|
||||
func editorMarkdownStyleEnd(active bool) string {
|
||||
foreground := "\x1b[39m"
|
||||
if active {
|
||||
switch currentThemeName {
|
||||
case "dark":
|
||||
foreground = "\x1b[38;2;215;218;232m"
|
||||
case "light":
|
||||
foreground = "\x1b[38;2;36;41;47m"
|
||||
case "high-contrast":
|
||||
foreground = "\x1b[38;2;255;255;255m"
|
||||
}
|
||||
if active && colorEnabled {
|
||||
foreground = foregroundSequence(editorMarkdownTheme.EditorForeground)
|
||||
}
|
||||
return "\x1b[22;23;24m" + foreground
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user