Skip to main content

palette.py

1from typing import TypedDict
4class BaseColours(TypedDict):
5 background: str
6 text: str
7 accent_grey: str
8 red: str
9 green: str
10 blue: str
11 magenta: str
12 yellow: str
13 cyan: str
14 highlight: str
17class Colours(BaseColours):
18 comment: str
19 literal: str
20 string: str
21 name: str
22 punctuation: str
25def enrich_colours(c: BaseColours) -> Colours:
26 return {
27 **c,
28 "text": c["text"],
29 "comment": c["red"],
30 "literal": c["magenta"],
31 "string": c["green"],
32 "name": c["blue"],
33 "punctuation": c["accent_grey"],
34 }
37class BasePalette(TypedDict):
38 id: str
39 light: BaseColours
40 dark: BaseColours
43class Palette(TypedDict):
44 light: Colours
45 dark: Colours