Skip to content

how do I use custom style #43

@WhoMI7

Description

@WhoMI7

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:

  • [ x] I've restarted Anki to see if it helps
  • [ x] I've verified that I use the latest version of the add-on by redownloading it from AnkiWeb
  • [ x] I've verified that I use the latest version of Anki by checking at https://apps.ankiweb.net#download
  • [ x] I've tried to disable other add-ons to see if there are any interactions present
  • My issue disappears when I hold shift while starting Anki.
  • [x ] I've checked if anyone else reported this problem before by looking through the issue reports. I also checked to see if there is a section about known issues in the add-on description, documentation, or README.

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):

  • OS: Windows 11
  • version: Version 22H2 (KB5029263)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions