contrib/style.go (view raw)
1// style.go: generate chroma css
2// go run contrib/style.go > syntax.css
3package main
4
5import (
6 "os"
7
8 "github.com/alecthomas/chroma"
9 "github.com/alecthomas/chroma/formatters/html"
10)
11
12var syntax = chroma.MustNewStyle("syntax", chroma.StyleEntries{
13 chroma.CommentMultiline: "italic #999988",
14 chroma.CommentPreproc: "bold #999999",
15 chroma.CommentSingle: "italic #999988",
16 chroma.CommentSpecial: "bold italic #999999",
17 chroma.Comment: "italic #999988",
18 chroma.Error: "bg:#e3d2d2 #a61717",
19 chroma.GenericDeleted: "bg:#ffdddd #000000",
20 chroma.GenericEmph: "italic #000000",
21 chroma.GenericError: "#aa0000",
22 chroma.GenericHeading: "#999999",
23 chroma.GenericInserted: "bg:#ddffdd #000000",
24 chroma.GenericOutput: "#888888",
25 chroma.GenericPrompt: "#555555",
26 chroma.GenericStrong: "bold",
27 chroma.GenericSubheading: "#aaaaaa",
28 chroma.GenericTraceback: "#aa0000",
29 chroma.GenericUnderline: "underline",
30 chroma.KeywordType: "bold #222222",
31 chroma.Keyword: "bold #000000",
32 chroma.LiteralNumber: "#009999",
33 chroma.LiteralStringRegex: "#009926",
34 chroma.LiteralStringSymbol: "#990073",
35 chroma.LiteralString: "#509c93",
36 chroma.NameAttribute: "#008080",
37 chroma.NameBuiltinPseudo: "#999999",
38 chroma.NameBuiltin: "#509c93",
39 chroma.NameClass: "bold #666666",
40 chroma.NameConstant: "#008080",
41 chroma.NameDecorator: "bold #3c5d5d",
42 chroma.NameEntity: "#509c93",
43 chroma.NameException: "bold #444444",
44 chroma.NameFunction: "bold #444444",
45 chroma.NameLabel: "bold #444444",
46 chroma.NameNamespace: "#555555",
47 chroma.NameTag: "#000080",
48 chroma.NameVariableClass: "#008080",
49 chroma.NameVariableGlobal: "#008080",
50 chroma.NameVariableInstance: "#008080",
51 chroma.NameVariable: "#008080",
52 chroma.Operator: "bold #000000",
53 chroma.TextWhitespace: "#bbbbbb",
54 chroma.Background: " bg:#ffffff",
55})
56
57func main() {
58 formatter := html.New(html.WithClasses(true))
59 formatter.WriteCSS(os.Stdout, syntax)
60}