Skip to content

Commit 2d0df3d

Browse files
authored
fix(extras/pygments): align syntax highlighting tokens with style guide (#75)
* fix(extras/pygments): align syntax highlighting tokens with style guide * fix(extras/pygments): update `Keyword.Type`, add tokens reference link in comment * fix(extras/pygments): `Keyword.Constant` should be mauve
1 parent 0bf1651 commit 2d0df3d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

catppuccin/extras/pygments.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030

3131

3232
def _make_styles(colors: FlavorColors) -> dict[_TokenType, str]:
33+
# https://pygments.org/docs/tokens/
3334
return {
34-
Comment: colors.overlay0.hex,
35-
Comment.Hashbang: colors.overlay0.hex,
36-
Comment.Multiline: colors.overlay0.hex,
35+
Comment: colors.overlay2.hex,
36+
Comment.Hashbang: colors.overlay2.hex,
37+
Comment.Multiline: colors.overlay2.hex,
3738
Comment.Preproc: colors.pink.hex,
38-
Comment.Single: colors.overlay0.hex,
39-
Comment.Special: colors.overlay0.hex,
39+
Comment.Single: colors.overlay2.hex,
40+
Comment.Special: colors.overlay2.hex,
4041
Generic: colors.text.hex,
4142
Generic.Deleted: colors.red.hex,
4243
Generic.Emph: f"{colors.text.hex} underline",
@@ -51,13 +52,13 @@ def _make_styles(colors: FlavorColors) -> dict[_TokenType, str]:
5152
Error: colors.text.hex,
5253
# `as`
5354
Keyword: colors.mauve.hex,
54-
Keyword.Constant: colors.pink.hex,
55-
Keyword.Declaration: f"{colors.teal.hex} italic",
55+
Keyword.Constant: colors.mauve.hex,
56+
Keyword.Declaration: f"{colors.mauve.hex} italic",
5657
# `from`, `import`
5758
Keyword.Namespace: colors.mauve.hex,
5859
Keyword.Pseudo: colors.pink.hex,
5960
Keyword.Reserved: colors.pink.hex,
60-
Keyword.Type: colors.teal.hex,
61+
Keyword.Type: colors.yellow.hex,
6162
Literal: colors.text.hex,
6263
Literal.Date: colors.text.hex,
6364
# from xxx import NAME
@@ -66,7 +67,7 @@ def _make_styles(colors: FlavorColors) -> dict[_TokenType, str]:
6667
Name: colors.text.hex,
6768
Name.Attribute: colors.green.hex,
6869
# `len`, `print`
69-
Name.Builtin: f"{colors.peach.hex} italic",
70+
Name.Builtin: f"{colors.red.hex} italic",
7071
# `self`
7172
Name.Builtin.Pseudo: colors.red.hex,
7273
# class Name.Class:
@@ -104,13 +105,13 @@ def _make_styles(colors: FlavorColors) -> dict[_TokenType, str]:
104105
String.Char: colors.green.hex,
105106
String.Doc: colors.green.hex,
106107
String.Double: colors.green.hex,
107-
String.Escape: colors.green.hex,
108+
String.Escape: colors.pink.hex,
108109
String.Heredoc: colors.green.hex,
109110
String.Interpol: colors.green.hex,
110111
String.Other: colors.green.hex,
111-
String.Regex: colors.green.hex,
112+
String.Regex: colors.pink.hex,
112113
String.Single: colors.green.hex,
113-
String.Symbol: colors.green.hex,
114+
String.Symbol: colors.red.hex,
114115
Text: colors.text.hex,
115116
Whitespace: colors.text.hex,
116117
}

0 commit comments

Comments
 (0)