1import { Scale } from "chroma-js"
2import { FontWeight } from "../../common"
3
4export interface ColorScheme {
5 name: string
6 isLight: boolean
7
8 lowest: Layer
9 middle: Layer
10 highest: Layer
11
12 ramps: RampSet
13
14 popoverShadow: Shadow
15 modalShadow: Shadow
16
17 players: Players
18 syntax?: Partial<ThemeSyntax>
19}
20
21export interface Meta {
22 name: string
23 author: string
24 url: string
25 license: License
26}
27
28export interface License {
29 SPDX: SPDXExpression
30 /// A url where we can download the license's text
31 https_url: string
32 license_checksum: string
33}
34
35// License name -> License text
36export interface Licenses {
37 [key: string]: string
38}
39
40// FIXME: Add support for the SPDX expression syntax
41export type SPDXExpression = "MIT"
42
43export interface Player {
44 cursor: string
45 selection: string
46}
47
48export interface Players {
49 "0": Player
50 "1": Player
51 "2": Player
52 "3": Player
53 "4": Player
54 "5": Player
55 "6": Player
56 "7": Player
57}
58
59export interface Shadow {
60 blur: number
61 color: string
62 offset: number[]
63}
64
65export type StyleSets = keyof Layer
66export interface Layer {
67 base: StyleSet
68 variant: StyleSet
69 on: StyleSet
70 accent: StyleSet
71 positive: StyleSet
72 warning: StyleSet
73 negative: StyleSet
74}
75
76export interface RampSet {
77 neutral: Scale
78 red: Scale
79 orange: Scale
80 yellow: Scale
81 green: Scale
82 cyan: Scale
83 blue: Scale
84 violet: Scale
85 magenta: Scale
86}
87
88export type Styles = keyof StyleSet
89export interface StyleSet {
90 default: Style
91 active: Style
92 disabled: Style
93 hovered: Style
94 pressed: Style
95 inverted: Style
96}
97
98export interface Style {
99 background: string
100 border: string
101 foreground: string
102}
103
104export interface SyntaxHighlightStyle {
105 color: string
106 weight?: FontWeight
107 underline?: boolean
108 italic?: boolean
109}
110
111export interface Syntax {
112 primary: SyntaxHighlightStyle
113 "variable.special": SyntaxHighlightStyle
114 comment: SyntaxHighlightStyle
115 punctuation: SyntaxHighlightStyle
116 constant: SyntaxHighlightStyle
117 keyword: SyntaxHighlightStyle
118 function: SyntaxHighlightStyle
119 type: SyntaxHighlightStyle
120 constructor: SyntaxHighlightStyle
121 variant: SyntaxHighlightStyle
122 property: SyntaxHighlightStyle
123 enum: SyntaxHighlightStyle
124 operator: SyntaxHighlightStyle
125 string: SyntaxHighlightStyle
126 number: SyntaxHighlightStyle
127 boolean: SyntaxHighlightStyle
128 predictive: SyntaxHighlightStyle
129 title: SyntaxHighlightStyle
130 emphasis: SyntaxHighlightStyle
131 "emphasis.strong": SyntaxHighlightStyle
132 linkUri: SyntaxHighlightStyle
133 linkText: SyntaxHighlightStyle
134}
135
136// HACK: "constructor" as a key in the syntax interface returns an error when a theme tries to use it.
137// For now hack around it by omiting constructor as a valid key for overrides.
138export type ThemeSyntax = Partial<Omit<Syntax, "constructor">>