From b5340f4407f9907b51a73349b40168db06c236f7 Mon Sep 17 00:00:00 2001 From: Raffaele Mancuso Date: Tue, 30 Jan 2024 12:53:09 +0100 Subject: [PATCH] Refactor for style guide --- catppuccin/extras/pygments.py | 114 +++++++++++++++++++++++++++------- 1 file changed, 93 insertions(+), 21 deletions(-) diff --git a/catppuccin/extras/pygments.py b/catppuccin/extras/pygments.py index c0fc886..aea627d 100644 --- a/catppuccin/extras/pygments.py +++ b/catppuccin/extras/pygments.py @@ -17,6 +17,8 @@ String, Text, Token, + Whitespace, + Other, _TokenType, ) @@ -25,31 +27,101 @@ def _make_styles(flavour: Flavour) -> Dict[_TokenType, str]: return { - Token: f"#{flavour.text.hex}", - Text: f"#{flavour.text.hex}", - Error: f"#{flavour.red.hex}", + Comment: f"#{flavour.overlay0.hex}", + Comment.Hashbang: f"#{flavour.overlay0.hex}", + Comment.Multiline: f"#{flavour.overlay0.hex}", + Comment.Preproc: f"#{flavour.pink.hex}", + Comment.Single: f"#{flavour.overlay0.hex}", + Comment.Special: f"#{flavour.overlay0.hex}", + + Generic: f"#{flavour.text.hex}", + Generic.Deleted: f"#{flavour.red.hex}", + Generic.Emph: f"#{flavour.text.hex} underline", + Generic.Error: f"#{flavour.text.hex}", + Generic.Heading: f"#{flavour.text.hex} bold", + Generic.Inserted: f"#{flavour.text.hex} bold", + Generic.Output: f"#{flavour.overlay0.hex}", + Generic.Prompt: f"#{flavour.text.hex}", + Generic.Strong: f"#{flavour.text.hex}", + Generic.Subheading: f"#{flavour.text.hex} bold", + Generic.Traceback: f"#{flavour.text.hex}", + + Error: f"#{flavour.text.hex}", + + # `as` Keyword: f"#{flavour.mauve.hex}", - Keyword.Constant: f"#{flavour.peach.hex}", - Keyword.Declaration: f"#{flavour.blue.hex}", - Keyword.Namespace: f"#{flavour.teal.hex}", - Keyword.Pseudo: f"#{flavour.mauve.hex}", - Keyword.Reserved: f"#{flavour.mauve.hex}", - Keyword.Type: f"#{flavour.blue.hex}", - Name: f"#{flavour.peach.hex}", - Name.Attribute: f"#{flavour.blue.hex}", - Name.Constant: f"#{flavour.yellow.hex}", - Name.Decorator: f"#{flavour.blue.hex}", - Name.Function: f"#{flavour.blue.hex}", - Name.Function.Magic: f"#{flavour.sky.hex}", - Name.Label: f"#{flavour.blue.hex}", - Name.Tag: f"#{flavour.mauve.hex}", + Keyword.Constant: f"#{flavour.pink.hex}", + Keyword.Declaration: f"#{flavour.teal.hex} italic", + # `from`, `import` + Keyword.Namespace: f"#{flavour.mauve.hex}", + Keyword.Pseudo: f"#{flavour.pink.hex}", + Keyword.Reserved: f"#{flavour.pink.hex}", + Keyword.Type: f"#{flavour.teal.hex}", + Literal: f"#{flavour.text.hex}", - String: f"#{flavour.green.hex}", + Literal.Date: f"#{flavour.text.hex}", + + # from xxx import NAME + # NAME = NAME + # NAME.NAME() + Name: f"#{flavour.text.hex}", + Name.Attribute: f"#{flavour.green.hex}", + # `len`, `print` + Name.Builtin: f"#{flavour.peach.hex} italic", + # `self` + Name.Builtin.Pseudo: f"#{flavour.red.hex}", + # class Name.Class: + Name.Class: f"#{flavour.yellow.hex}", + Name.Constant: f"#{flavour.text.hex}", + Name.Decorator: f"#{flavour.text.hex}", + Name.Entity: f"#{flavour.text.hex}", + Name.Exception: f"#{flavour.text.hex}", + # def __Name.Label__( + Name.Function: f"#{flavour.sapphire.hex}", + Name.Label: f"#{flavour.teal.hex} italic", + Name.Namespace: f"#{flavour.text.hex}", + Name.Other: f"#{flavour.text.hex}", + Name.Tag: f"#{flavour.pink.hex}", + Name.Variable: f"#{flavour.crust.hex} italic", + Name.Variable.Class: f"#{flavour.crust.hex} italic", + Name.Variable.Global: f"#{flavour.crust.hex} italic", + Name.Variable.Instance: f"#{flavour.crust.hex} italic", + Number: f"#{flavour.peach.hex}", - Punctuation: f"#{flavour.text.hex}", + Number.Bin: f"#{flavour.peach.hex}", + Number.Float: f"#{flavour.peach.hex}", + Number.Hex: f"#{flavour.peach.hex}", + Number.Integer: f"#{flavour.peach.hex}", + Number.Integer.Long: f"#{flavour.peach.hex}", + Number.Oct: f"#{flavour.peach.hex}", + + # `=` Operator: f"#{flavour.sky.hex}", - Comment: f"#{flavour.overlay0.hex}", - Generic.Heading: f"#{flavour.blue.hex} bold", + # `not`, `in` + Operator.Word: f"#{flavour.mauve.hex}", + + Other: f"#{flavour.text.hex}", + + # `(`, `)`, `,`, `[`, `]`, `:` + Punctuation: f"#{flavour.overlay2.hex}", + + String: f"#{flavour.green.hex}", + String.Backtick: f"#{flavour.green.hex}", + String.Char: f"#{flavour.green.hex}", + String.Doc: f"#{flavour.green.hex}", + String.Double: f"#{flavour.green.hex}", + String.Escape: f"#{flavour.green.hex}", + String.Heredoc: f"#{flavour.green.hex}", + String.Interpol: f"#{flavour.green.hex}", + String.Other: f"#{flavour.green.hex}", + String.Regex: f"#{flavour.green.hex}", + String.Single: f"#{flavour.green.hex}", + String.Symbol: f"#{flavour.green.hex}", + + Text: f"#{flavour.text.hex}", + + Whitespace: f"#{flavour.text.hex}" + }