palette.py761 bytesPythonView raw1from typing import TypedDict 2 3 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 15 16 17class Colours(BaseColours): 18 comment: str 19 literal: str 20 string: str 21 name: str 22 punctuation: str 23 24 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 } 35 36 37class BasePalette(TypedDict): 38 id: str 39 light: BaseColours 40 dark: BaseColours 41 42 43class Palette(TypedDict): 44 light: Colours 45 dark: Colours