commit 47a3a5ec69083d8fc4182f68f92ba4af1a6748e6
parent 9288c310ad115342e99a09a8aff791875d1b97f4
Author: FIGBERT <figbert@figbert.com>
Date: Fri, 20 Oct 2023 11:22:26 -0700
Adopt new standardized CLX heading style
Diffstat:
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/ui/glamour.go b/ui/glamour.go
@@ -1,15 +1,19 @@
package ui
import (
+ "strings"
+
"github.com/charmbracelet/glamour/ansi"
+ gloss "github.com/charmbracelet/lipgloss"
)
+const block = "█"
+
var GlamourConfig = ansi.StyleConfig{
Document: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
BlockPrefix: "\n",
BlockSuffix: "\n",
- Color: stringPtr("252"),
},
Margin: uintPtr(2),
},
@@ -24,45 +28,37 @@ var GlamourConfig = ansi.StyleConfig{
Heading: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
BlockSuffix: "\n",
- Color: stringPtr("39"),
Bold: boolPtr(true),
},
},
H1: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Prefix: " ",
- Suffix: " ",
- Color: stringPtr("228"),
- BackgroundColor: stringPtr("63"),
- Bold: boolPtr(true),
+ Prefix: gloss.NewStyle().Foreground(gloss.Color("15")).Render(block) + " ",
},
},
H2: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Color: stringPtr("252"),
+ Prefix: gloss.NewStyle().Foreground(gloss.Color("12")).Render(block) + " ",
},
},
H3: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Underline: boolPtr(true),
+ Prefix: gloss.NewStyle().Foreground(gloss.Color("9")).Render(strings.Repeat(block, 2)) + " ",
},
},
H4: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Color: stringPtr("220"),
- Underline: boolPtr(true),
+ Prefix: gloss.NewStyle().Foreground(gloss.Color("13")).Render(strings.Repeat(block, 3)) + " ",
},
},
H5: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Prefix: "##### ",
+ Prefix: gloss.NewStyle().Foreground(gloss.Color("11")).Render(strings.Repeat(block, 4)) + " ",
},
},
H6: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Prefix: "###### ",
- Color: stringPtr("35"),
- Bold: boolPtr(false),
+ Prefix: gloss.NewStyle().Foreground(gloss.Color("10")).Render(strings.Repeat(block, 5)) + " ",
},
},
Strikethrough: ansi.StylePrimitive{