Skip to content

Commit 36cddb8

Browse files
TEParsonssgoudham
andauthored
feat: Improvements to pygments styles (#18)
* feat: Add Generic.Heading to pygments and style * feat: Add IDE colours to pygments styles * chore: lint --------- Co-authored-by: sgoudham <sgoudham@gmail.com>
1 parent 2570f6e commit 36cddb8

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

catppuccin/extras/pygments.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from pygments.token import (
88
Comment,
99
Error,
10+
Generic,
1011
Keyword,
1112
Literal,
1213
Name,
@@ -48,28 +49,53 @@ def _make_styles(flavour: Flavour) -> Dict[_TokenType, str]:
4849
Punctuation: f"#{flavour.text.hex}",
4950
Operator: f"#{flavour.sky.hex}",
5051
Comment: f"#{flavour.overlay0.hex}",
52+
Generic.Heading: f"#{flavour.blue.hex} bold",
5153
}
5254

5355

5456
class LatteStyle(Style): # pylint: disable=too-few-public-methods
5557
"""Catppuccin Latte pygments style."""
5658

57-
styles = _make_styles(Flavour.latte())
59+
_flavour = Flavour.latte()
60+
61+
background_color = f"#{_flavour.base.hex}"
62+
line_number_background_color = f"#{_flavour.mantle.hex}"
63+
line_number_color = f"#{_flavour.text.hex}"
64+
65+
styles = _make_styles(_flavour)
5866

5967

6068
class FrappeStyle(Style): # pylint: disable=too-few-public-methods
6169
"""Catppuccin Frappé pygments style."""
6270

63-
styles = _make_styles(Flavour.frappe())
71+
_flavour = Flavour.frappe()
72+
73+
background_color = f"#{_flavour.base.hex}"
74+
line_number_background_color = f"#{_flavour.mantle.hex}"
75+
line_number_color = f"#{_flavour.text.hex}"
76+
77+
styles = _make_styles(_flavour)
6478

6579

6680
class MacchiatoStyle(Style): # pylint: disable=too-few-public-methods
6781
"""Catppuccin Macchiato pygments style."""
6882

69-
styles = _make_styles(Flavour.macchiato())
83+
_flavour = Flavour.macchiato()
84+
85+
background_color = f"#{_flavour.base.hex}"
86+
line_number_background_color = f"#{_flavour.mantle.hex}"
87+
line_number_color = f"#{_flavour.text.hex}"
88+
89+
styles = _make_styles(_flavour)
7090

7191

7292
class MochaStyle(Style): # pylint: disable=too-few-public-methods
7393
"""Catppuccin Mocha pygments style."""
7494

75-
styles = _make_styles(Flavour.mocha())
95+
_flavour = Flavour.mocha()
96+
97+
background_color = f"#{_flavour.base.hex}"
98+
line_number_background_color = f"#{_flavour.mantle.hex}"
99+
line_number_color = f"#{_flavour.text.hex}"
100+
101+
styles = _make_styles(_flavour)

0 commit comments

Comments
 (0)