package glamour //go:generate go run ./internal/generate-style-json import ( "github.com/charmbracelet/glamour/ansi" ) var ( // ASCIIStyleConfig uses only ASCII characters. ASCIIStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", }, Margin: uintPtr(2), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("| "), }, Paragraph: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, List: ansi.StyleList{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, LevelIndent: 4, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "# ", }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", }, }, Strikethrough: ansi.StylePrimitive{ BlockPrefix: "~~", BlockSuffix: "~~", }, Emph: ansi.StylePrimitive{ BlockPrefix: "*", BlockSuffix: "*", }, Strong: ansi.StylePrimitive{ BlockPrefix: "**", BlockSuffix: "**", }, HorizontalRule: ansi.StylePrimitive{ Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ Ticked: "[x] ", Unticked: "[ ] ", }, ImageText: ansi.StylePrimitive{ Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "`", BlockSuffix: "`", }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ Margin: uintPtr(2), }, }, Table: ansi.StyleTable{ CenterSeparator: stringPtr("+"), ColumnSeparator: stringPtr("|"), RowSeparator: stringPtr("-"), }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n* ", }, } // DarkStyleConfig is the default dark style. DarkStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", Color: stringPtr("252"), }, Margin: uintPtr(2), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, List: ansi.StyleList{ LevelIndent: 2, }, 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), }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", Color: stringPtr("35"), Bold: boolPtr(false), }, }, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("240"), Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ StylePrimitive: ansi.StylePrimitive{}, Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("30"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Color: stringPtr("35"), Bold: boolPtr(true), }, Image: ansi.StylePrimitive{ Color: stringPtr("212"), Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Color: stringPtr("243"), Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("203"), BackgroundColor: stringPtr("236"), }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("244"), }, Margin: uintPtr(2), }, Chroma: &ansi.Chroma{ Text: ansi.StylePrimitive{ Color: stringPtr("#C4C4C4"), }, Error: ansi.StylePrimitive{ Color: stringPtr("#F1F1F1"), BackgroundColor: stringPtr("#F05B5B"), }, Comment: ansi.StylePrimitive{ Color: stringPtr("#676767"), }, CommentPreproc: ansi.StylePrimitive{ Color: stringPtr("#FF875F"), }, Keyword: ansi.StylePrimitive{ Color: stringPtr("#00AAFF"), }, KeywordReserved: ansi.StylePrimitive{ Color: stringPtr("#FF5FD2"), }, KeywordNamespace: ansi.StylePrimitive{ Color: stringPtr("#FF5F87"), }, KeywordType: ansi.StylePrimitive{ Color: stringPtr("#6E6ED8"), }, Operator: ansi.StylePrimitive{ Color: stringPtr("#EF8080"), }, Punctuation: ansi.StylePrimitive{ Color: stringPtr("#E8E8A8"), }, Name: ansi.StylePrimitive{ Color: stringPtr("#C4C4C4"), }, NameBuiltin: ansi.StylePrimitive{ Color: stringPtr("#FF8EC7"), }, NameTag: ansi.StylePrimitive{ Color: stringPtr("#B083EA"), }, NameAttribute: ansi.StylePrimitive{ Color: stringPtr("#7A7AE6"), }, NameClass: ansi.StylePrimitive{ Color: stringPtr("#F1F1F1"), Underline: boolPtr(true), Bold: boolPtr(true), }, NameDecorator: ansi.StylePrimitive{ Color: stringPtr("#FFFF87"), }, NameFunction: ansi.StylePrimitive{ Color: stringPtr("#00D787"), }, LiteralNumber: ansi.StylePrimitive{ Color: stringPtr("#6EEFC0"), }, LiteralString: ansi.StylePrimitive{ Color: stringPtr("#C69669"), }, LiteralStringEscape: ansi.StylePrimitive{ Color: stringPtr("#AFFFD7"), }, GenericDeleted: ansi.StylePrimitive{ Color: stringPtr("#FD5B5B"), }, GenericEmph: ansi.StylePrimitive{ Italic: boolPtr(true), }, GenericInserted: ansi.StylePrimitive{ Color: stringPtr("#00D787"), }, GenericStrong: ansi.StylePrimitive{ Bold: boolPtr(true), }, GenericSubheading: ansi.StylePrimitive{ Color: stringPtr("#777777"), }, Background: ansi.StylePrimitive{ BackgroundColor: stringPtr("#373737"), }, }, }, Table: ansi.StyleTable{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, CenterSeparator: stringPtr("┼"), ColumnSeparator: stringPtr("│"), RowSeparator: stringPtr("─"), }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } // LightStyleConfig is the default light style. LightStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", Color: stringPtr("234"), }, Margin: uintPtr(2), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, List: ansi.StyleList{ LevelIndent: 2, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", Color: stringPtr("27"), Bold: boolPtr(true), }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("228"), BackgroundColor: stringPtr("63"), Bold: boolPtr(true), }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", Bold: boolPtr(false), }, }, Strikethrough: ansi.StylePrimitive{ CrossedOut: boolPtr(true), }, Emph: ansi.StylePrimitive{ Italic: boolPtr(true), }, Strong: ansi.StylePrimitive{ Bold: boolPtr(true), }, HorizontalRule: ansi.StylePrimitive{ Color: stringPtr("249"), Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ StylePrimitive: ansi.StylePrimitive{}, Ticked: "[✓] ", Unticked: "[ ] ", }, Link: ansi.StylePrimitive{ Color: stringPtr("36"), Underline: boolPtr(true), }, LinkText: ansi.StylePrimitive{ Color: stringPtr("29"), Bold: boolPtr(true), }, Image: ansi.StylePrimitive{ Color: stringPtr("205"), Underline: boolPtr(true), }, ImageText: ansi.StylePrimitive{ Color: stringPtr("243"), Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: " ", Suffix: " ", Color: stringPtr("203"), BackgroundColor: stringPtr("254"), }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Color: stringPtr("242"), }, Margin: uintPtr(2), }, Chroma: &ansi.Chroma{ Text: ansi.StylePrimitive{ Color: stringPtr("#2A2A2A"), }, Error: ansi.StylePrimitive{ Color: stringPtr("#F1F1F1"), BackgroundColor: stringPtr("#FF5555"), }, Comment: ansi.StylePrimitive{ Color: stringPtr("#8D8D8D"), }, CommentPreproc: ansi.StylePrimitive{ Color: stringPtr("#FF875F"), }, Keyword: ansi.StylePrimitive{ Color: stringPtr("#279EFC"), }, KeywordReserved: ansi.StylePrimitive{ Color: stringPtr("#FF5FD2"), }, KeywordNamespace: ansi.StylePrimitive{ Color: stringPtr("#FB406F"), }, KeywordType: ansi.StylePrimitive{ Color: stringPtr("#7049C2"), }, Operator: ansi.StylePrimitive{ Color: stringPtr("#FF2626"), }, Punctuation: ansi.StylePrimitive{ Color: stringPtr("#FA7878"), }, NameBuiltin: ansi.StylePrimitive{ Color: stringPtr("#0A1BB1"), }, NameTag: ansi.StylePrimitive{ Color: stringPtr("#581290"), }, NameAttribute: ansi.StylePrimitive{ Color: stringPtr("#8362CB"), }, NameClass: ansi.StylePrimitive{ Color: stringPtr("#212121"), Underline: boolPtr(true), Bold: boolPtr(true), }, NameConstant: ansi.StylePrimitive{ Color: stringPtr("#581290"), }, NameDecorator: ansi.StylePrimitive{ Color: stringPtr("#A3A322"), }, NameFunction: ansi.StylePrimitive{ Color: stringPtr("#019F57"), }, LiteralNumber: ansi.StylePrimitive{ Color: stringPtr("#22CCAE"), }, LiteralString: ansi.StylePrimitive{ Color: stringPtr("#7E5B38"), }, LiteralStringEscape: ansi.StylePrimitive{ Color: stringPtr("#00AEAE"), }, GenericDeleted: ansi.StylePrimitive{ Color: stringPtr("#FD5B5B"), }, GenericEmph: ansi.StylePrimitive{ Italic: boolPtr(true), }, GenericInserted: ansi.StylePrimitive{ Color: stringPtr("#00D787"), }, GenericStrong: ansi.StylePrimitive{ Bold: boolPtr(true), }, GenericSubheading: ansi.StylePrimitive{ Color: stringPtr("#777777"), }, Background: ansi.StylePrimitive{ BackgroundColor: stringPtr("#373737"), }, }, }, Table: ansi.StyleTable{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, CenterSeparator: stringPtr("┼"), ColumnSeparator: stringPtr("│"), RowSeparator: stringPtr("─"), }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } // NoTTYStyleConfig is the default notty style. NoTTYStyleConfig = ansi.StyleConfig{ Document: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "\n", BlockSuffix: "\n", }, Margin: uintPtr(2), }, BlockQuote: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, Indent: uintPtr(1), IndentToken: stringPtr("│ "), }, Paragraph: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, List: ansi.StyleList{ StyleBlock: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{}, }, LevelIndent: 4, }, Heading: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockSuffix: "\n", }, }, H1: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "# ", }, }, H2: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "## ", }, }, H3: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "### ", }, }, H4: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "#### ", }, }, H5: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "##### ", }, }, H6: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ Prefix: "###### ", }, }, Strikethrough: ansi.StylePrimitive{ BlockPrefix: "~~", BlockSuffix: "~~", }, Emph: ansi.StylePrimitive{ BlockPrefix: "*", BlockSuffix: "*", }, Strong: ansi.StylePrimitive{ BlockPrefix: "**", BlockSuffix: "**", }, HorizontalRule: ansi.StylePrimitive{ Format: "\n--------\n", }, Item: ansi.StylePrimitive{ BlockPrefix: "• ", }, Enumeration: ansi.StylePrimitive{ BlockPrefix: ". ", }, Task: ansi.StyleTask{ Ticked: "[✓] ", Unticked: "[ ] ", }, ImageText: ansi.StylePrimitive{ Format: "Image: {{.text}} →", }, Code: ansi.StyleBlock{ StylePrimitive: ansi.StylePrimitive{ BlockPrefix: "`", BlockSuffix: "`", }, }, CodeBlock: ansi.StyleCodeBlock{ StyleBlock: ansi.StyleBlock{ Margin: uintPtr(2), }, }, Table: ansi.StyleTable{ CenterSeparator: stringPtr("┼"), ColumnSeparator: stringPtr("│"), RowSeparator: stringPtr("─"), }, DefinitionDescription: ansi.StylePrimitive{ BlockPrefix: "\n🠶 ", }, } // DefaultStyles are the default styles. DefaultStyles = map[string]*ansi.StyleConfig{ "ascii": &ASCIIStyleConfig, "dark": &DarkStyleConfig, "light": &LightStyleConfig, "notty": &NoTTYStyleConfig, } ) func boolPtr(b bool) *bool { return &b } func stringPtr(s string) *string { return &s } func uintPtr(u uint) *uint { return &u }