glutanimate / syntax-highlighting

A fork of Tiago Barroso's Syntax Highlighting add-on with support for Anki 2.1
https://ankiweb.net/shared/info/1463041493
Other
108 stars 27 forks source link

how do I use custom style #43

Open BhaturaGuy opened 1 year ago

BhaturaGuy commented 1 year ago

Problem description

I want to use this style, I saved it in pygments\styles as tokyonight.py but I get always get error.

from pygments.style import Style
from pygments.token import (
    Comment,
    Error,
    Generic,
    Keyword,
    Literal,
    Name,
    Number,
    Operator,
    Punctuation,
    String,
    Text,
)

class TokyoNightStyle(Style):
    background_color = "#1a1b26"
    highlight_color = "#2a2c3d"
    default_style = ""

    styles = {
        Comment: "#5C6370",
        Comment.Preproc: "#5C6370",
        Comment.Special: "#5C6370",
        Keyword: "#C792EA",
        Keyword.Constant: "#C792EA",
        Keyword.Declaration: "#C792EA",
        Keyword.Namespace: "#C792EA",
        Keyword.Pseudo: "#C792EA",
        Keyword.Reserved: "#C792EA",
        Keyword.Type: "#7FDBCA",
        Operator: "#89DDFF",
        Operator.Word: "#89DDFF",
        Punctuation: "#89DDFF",
        Name: "#D8DEE9",
        Name.Attribute: "#D8DEE9",
        Name.Builtin: "#82AAFF",
        Name.Builtin.Pseudo: "#82AAFF",
        Name.Class: "#FFCB6B",
        Name.Constant: "#FF5370",
        Name.Decorator: "#FFCB6B",
        Name.Entity: "#F7768E",
        Name.Exception: "#FF5370",
        Name.Function: "#82AAFF",
        Name.Property: "#C792EA",
        Name.Label: "#82AAFF",
        Name.Namespace: "#FFCB6B",
        Name.Other: "#82AAFF",
        Name.Tag: "#7FDBCA",
        Name.Variable: "#FFCB6B",
        Name.Variable.Class: "#FFCB6B",
        Name.Variable.Global: "#FFCB6B",
        Name.Variable.Instance: "#FFCB6B",
        Number: "#F78C6C",
        Number.Float: "#F78C6C",
        Number.Hex: "#F78C6C",
        Number.Integer: "#F78C6C",
        Number.Integer.Long: "#F78C6C",
        Number.Oct: "#F78C6C",
        Literal: "#F78C6C",
        Literal.Date: "#F78C6C",
        String: "#C3E88D",
        String.Backtick: "#C3E88D",
        String.Char: "#C3E88D",
        String.Doc: "#5C6370",
        String.Double: "#C3E88D",
        String.Escape: "#FF5370",
        String.Heredoc: "#C3E88D",
        String.Interpol: "#C3E88D",
        String.Other: "#C3E88D",
        String.Regex: "#FF5370",
        String.Single: "#C3E88D",
        String.Symbol: "#C3E88D",
        String.Other: "#C792EA",
        Text: "#D8DEE9",
        Generic: "#D8DEE9",
        Generic.Deleted: "#FF5370",
        Generic.Emph: "italic",
        Generic.Error: "#FF5370",
        Generic.Heading: "#C792EA",
        Generic.Inserted: "#82AAFF",
        Generic.Output: "#D8DEE9",
        Generic.Prompt: "#C792EA",
        Generic.Strong: "bold",
        Generic.Subheading: "#82AAFF",
        Generic.Traceback: "#FFCB6B",
        Error: "#FF5370",
    }

Checklist

Please replace the space inside the brackets with an x if the following items apply:

Information about your Anki set-up

Please fill out the section corresponding with your Anki version:

If you are using Anki 2.1

Please open Anki, go to Help → About, click on "Copy Debug Info", and paste the result between the backticks below (if the button does not appear you are using an older version of Anki 2.1 and will need to update first):

If you are using Anki 2.0

Please open Anki, go to Help → About, find the two lines starting with Version: and Qt, and copy-paste them between the backticks below:

Please fill in details about your operating system (Windows/macOS/Linux, which version):

Please open Anki, go to Tools → Add-ons, take a screenshot of your installed add-ons, and paste it below: image

Error message (if any)

image