@@ -632,14 +632,14 @@ func DefaultStyles() Styles {
StylePrimitive: ansi.StylePrimitive{
// BlockPrefix: "\n",
// BlockSuffix: "\n",
- Color: stringPtr(charmtone.Smoke.Hex()),
+ Color: new(charmtone.Smoke.Hex()),
},
- // Margin: uintPtr(defaultMargin),
+ // Margin: new(uint(defaultMargin)),
},
BlockQuote: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{},
- Indent: uintPtr(1),
- IndentToken: stringPtr("│ "),
+ Indent: new(uint(1)),
+ IndentToken: new("│ "),
},
List: ansi.StyleList{
LevelIndent: defaultListIndent,
@@ -647,17 +647,17 @@ func DefaultStyles() Styles {
Heading: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
BlockSuffix: "\n",
- Color: stringPtr(charmtone.Malibu.Hex()),
- Bold: boolPtr(true),
+ Color: new(charmtone.Malibu.Hex()),
+ Bold: new(true),
},
},
H1: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: " ",
Suffix: " ",
- Color: stringPtr(charmtone.Zest.Hex()),
- BackgroundColor: stringPtr(charmtone.Charple.Hex()),
- Bold: boolPtr(true),
+ Color: new(charmtone.Zest.Hex()),
+ BackgroundColor: new(charmtone.Charple.Hex()),
+ Bold: new(true),
},
},
H2: ansi.StyleBlock{
@@ -683,21 +683,21 @@ func DefaultStyles() Styles {
H6: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: "###### ",
- Color: stringPtr(charmtone.Guac.Hex()),
- Bold: boolPtr(false),
+ Color: new(charmtone.Guac.Hex()),
+ Bold: new(false),
},
},
Strikethrough: ansi.StylePrimitive{
- CrossedOut: boolPtr(true),
+ CrossedOut: new(true),
},
Emph: ansi.StylePrimitive{
- Italic: boolPtr(true),
+ Italic: new(true),
},
Strong: ansi.StylePrimitive{
- Bold: boolPtr(true),
+ Bold: new(true),
},
HorizontalRule: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Charcoal.Hex()),
+ Color: new(charmtone.Charcoal.Hex()),
Format: "\n--------\n",
},
Item: ansi.StylePrimitive{
@@ -712,117 +712,117 @@ func DefaultStyles() Styles {
Unticked: "[ ] ",
},
Link: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Zinc.Hex()),
- Underline: boolPtr(true),
+ Color: new(charmtone.Zinc.Hex()),
+ Underline: new(true),
},
LinkText: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Guac.Hex()),
- Bold: boolPtr(true),
+ Color: new(charmtone.Guac.Hex()),
+ Bold: new(true),
},
Image: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Cheeky.Hex()),
- Underline: boolPtr(true),
+ Color: new(charmtone.Cheeky.Hex()),
+ Underline: new(true),
},
ImageText: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Squid.Hex()),
+ Color: new(charmtone.Squid.Hex()),
Format: "Image: {{.text}} →",
},
Code: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
Prefix: " ",
Suffix: " ",
- Color: stringPtr(charmtone.Coral.Hex()),
- BackgroundColor: stringPtr(charmtone.Charcoal.Hex()),
+ Color: new(charmtone.Coral.Hex()),
+ BackgroundColor: new(charmtone.Charcoal.Hex()),
},
},
CodeBlock: ansi.StyleCodeBlock{
StyleBlock: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Charcoal.Hex()),
+ Color: new(charmtone.Charcoal.Hex()),
},
- Margin: uintPtr(defaultMargin),
+ Margin: new(uint(defaultMargin)),
},
Chroma: &ansi.Chroma{
Text: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Smoke.Hex()),
+ Color: new(charmtone.Smoke.Hex()),
},
Error: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Butter.Hex()),
- BackgroundColor: stringPtr(charmtone.Sriracha.Hex()),
+ Color: new(charmtone.Butter.Hex()),
+ BackgroundColor: new(charmtone.Sriracha.Hex()),
},
Comment: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Oyster.Hex()),
+ Color: new(charmtone.Oyster.Hex()),
},
CommentPreproc: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Bengal.Hex()),
+ Color: new(charmtone.Bengal.Hex()),
},
Keyword: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Malibu.Hex()),
+ Color: new(charmtone.Malibu.Hex()),
},
KeywordReserved: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Pony.Hex()),
+ Color: new(charmtone.Pony.Hex()),
},
KeywordNamespace: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Pony.Hex()),
+ Color: new(charmtone.Pony.Hex()),
},
KeywordType: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Guppy.Hex()),
+ Color: new(charmtone.Guppy.Hex()),
},
Operator: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Salmon.Hex()),
+ Color: new(charmtone.Salmon.Hex()),
},
Punctuation: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Zest.Hex()),
+ Color: new(charmtone.Zest.Hex()),
},
Name: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Smoke.Hex()),
+ Color: new(charmtone.Smoke.Hex()),
},
NameBuiltin: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Cheeky.Hex()),
+ Color: new(charmtone.Cheeky.Hex()),
},
NameTag: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Mauve.Hex()),
+ Color: new(charmtone.Mauve.Hex()),
},
NameAttribute: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Hazy.Hex()),
+ Color: new(charmtone.Hazy.Hex()),
},
NameClass: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Salt.Hex()),
- Underline: boolPtr(true),
- Bold: boolPtr(true),
+ Color: new(charmtone.Salt.Hex()),
+ Underline: new(true),
+ Bold: new(true),
},
NameDecorator: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Citron.Hex()),
+ Color: new(charmtone.Citron.Hex()),
},
NameFunction: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Guac.Hex()),
+ Color: new(charmtone.Guac.Hex()),
},
LiteralNumber: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Julep.Hex()),
+ Color: new(charmtone.Julep.Hex()),
},
LiteralString: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Cumin.Hex()),
+ Color: new(charmtone.Cumin.Hex()),
},
LiteralStringEscape: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Bok.Hex()),
+ Color: new(charmtone.Bok.Hex()),
},
GenericDeleted: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Coral.Hex()),
+ Color: new(charmtone.Coral.Hex()),
},
GenericEmph: ansi.StylePrimitive{
- Italic: boolPtr(true),
+ Italic: new(true),
},
GenericInserted: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Guac.Hex()),
+ Color: new(charmtone.Guac.Hex()),
},
GenericStrong: ansi.StylePrimitive{
- Bold: boolPtr(true),
+ Bold: new(true),
},
GenericSubheading: ansi.StylePrimitive{
- Color: stringPtr(charmtone.Squid.Hex()),
+ Color: new(charmtone.Squid.Hex()),
},
Background: ansi.StylePrimitive{
- BackgroundColor: stringPtr(charmtone.Charcoal.Hex()),
+ BackgroundColor: new(charmtone.Charcoal.Hex()),
},
},
},
@@ -837,8 +837,8 @@ func DefaultStyles() Styles {
}
// PlainMarkdown style - muted colors on subtle background for thinking content.
- plainBg := stringPtr(bgBaseLighter.Hex())
- plainFg := stringPtr(fgMuted.Hex())
+ plainBg := new(bgBaseLighter.Hex())
+ plainFg := new(fgMuted.Hex())
s.PlainMarkdown = ansi.StyleConfig{
Document: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
@@ -851,8 +851,8 @@ func DefaultStyles() Styles {
Color: plainFg,
BackgroundColor: plainBg,
},
- Indent: uintPtr(1),
- IndentToken: stringPtr("│ "),
+ Indent: new(uint(1)),
+ IndentToken: new("│ "),
},
List: ansi.StyleList{
LevelIndent: defaultListIndent,
@@ -860,7 +860,7 @@ func DefaultStyles() Styles {
Heading: ansi.StyleBlock{
StylePrimitive: ansi.StylePrimitive{
BlockSuffix: "\n",
- Bold: boolPtr(true),
+ Bold: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
@@ -869,7 +869,7 @@ func DefaultStyles() Styles {
StylePrimitive: ansi.StylePrimitive{
Prefix: " ",
Suffix: " ",
- Bold: boolPtr(true),
+ Bold: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
@@ -910,17 +910,17 @@ func DefaultStyles() Styles {
},
},
Strikethrough: ansi.StylePrimitive{
- CrossedOut: boolPtr(true),
+ CrossedOut: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
Emph: ansi.StylePrimitive{
- Italic: boolPtr(true),
+ Italic: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
Strong: ansi.StylePrimitive{
- Bold: boolPtr(true),
+ Bold: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
@@ -948,17 +948,17 @@ func DefaultStyles() Styles {
Unticked: "[ ] ",
},
Link: ansi.StylePrimitive{
- Underline: boolPtr(true),
+ Underline: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
LinkText: ansi.StylePrimitive{
- Bold: boolPtr(true),
+ Bold: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
Image: ansi.StylePrimitive{
- Underline: boolPtr(true),
+ Underline: new(true),
Color: plainFg,
BackgroundColor: plainBg,
},
@@ -981,7 +981,7 @@ func DefaultStyles() Styles {
Color: plainFg,
BackgroundColor: plainBg,
},
- Margin: uintPtr(defaultMargin),
+ Margin: new(uint(defaultMargin)),
},
},
Table: ansi.StyleTable{
@@ -1368,10 +1368,6 @@ func DefaultStyles() Styles {
return s
}
-// Helper functions for style pointers
-func boolPtr(b bool) *bool { return &b }
-func stringPtr(s string) *string { return &s }
-func uintPtr(u uint) *uint { return &u }
func chromaStyle(style ansi.StylePrimitive) string {
var s strings.Builder