@operad-io/tui 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/package.json +27 -4
- package/src/actions.ts +997 -0
- package/src/app.ts +1665 -0
- package/src/args.ts +198 -0
- package/src/autostart.ts +302 -0
- package/src/client.ts +478 -0
- package/src/discover.ts +90 -0
- package/src/events.ts +345 -0
- package/src/index.ts +11 -0
- package/src/layout.ts +260 -0
- package/src/live.ts +113 -0
- package/src/markdown.ts +85 -0
- package/src/recent.ts +40 -0
- package/src/sanitize.ts +18 -0
- package/src/state.ts +3200 -0
- package/src/theme.ts +525 -0
- package/src/themes.ts +60 -0
- package/src/view/index.ts +1204 -0
- package/src/wrap.ts +156 -0
- package/theme.schema.json +197 -0
- package/themes/LICENSE-catppuccin +21 -0
- package/themes/LICENSE-dracula +21 -0
- package/themes/LICENSE-github +21 -0
- package/themes/LICENSE-kanagawa +21 -0
- package/themes/LICENSE-nord +21 -0
- package/themes/LICENSE-one +20 -0
- package/themes/LICENSE-rose-pine +21 -0
- package/themes/LICENSE-solarized +20 -0
- package/themes/LICENSE-tokyo-night +22 -0
- package/themes/README.md +81 -0
- package/themes/catppuccin-frappe.json +19 -0
- package/themes/catppuccin-latte.json +19 -0
- package/themes/catppuccin-macchiato.json +19 -0
- package/themes/catppuccin-mocha.json +19 -0
- package/themes/dracula.json +19 -0
- package/themes/github-dark.json +19 -0
- package/themes/github-light.json +19 -0
- package/themes/kanagawa-dragon.json +19 -0
- package/themes/kanagawa-lotus.json +19 -0
- package/themes/kanagawa-wave.json +19 -0
- package/themes/nord.json +19 -0
- package/themes/one-dark.json +19 -0
- package/themes/one-light.json +19 -0
- package/themes/rose-pine-dawn.json +19 -0
- package/themes/rose-pine-main.json +19 -0
- package/themes/solarized-dark.json +19 -0
- package/themes/solarized-light.json +19 -0
- package/themes/tokyo-night-day.json +19 -0
- package/themes/tokyo-night-night.json +19 -0
- package/tui.schema.json +24 -0
package/src/wrap.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapping for rendered Markdown. The reducer counts the rows a section takes
|
|
3
|
+
* and the view draws exactly those rows, so both use this one algorithm, and
|
|
4
|
+
* both measure by display width: a CJK character or an emoji takes two columns,
|
|
5
|
+
* a combining mark none.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** One display character (a grapheme) and the style it carries. */
|
|
9
|
+
export interface WrapGlyph<T> {
|
|
10
|
+
readonly char: string;
|
|
11
|
+
readonly value: T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const segmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
15
|
+
const PLAIN = /^[\x20-\x7e]*$/;
|
|
16
|
+
|
|
17
|
+
/** The display characters of `text`: grapheme clusters, not code points. */
|
|
18
|
+
export function graphemes(text: string): string[] {
|
|
19
|
+
if (PLAIN.test(text)) return [...text];
|
|
20
|
+
return Array.from(segmenter.segment(text), (part) => part.segment);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The columns one display character takes: 0, 1 or 2. */
|
|
24
|
+
export function displayWidth(char: string): number {
|
|
25
|
+
if (char.length === 1) {
|
|
26
|
+
const code = char.charCodeAt(0);
|
|
27
|
+
if (code >= 0x20 && code < 0x7f) return 1;
|
|
28
|
+
}
|
|
29
|
+
return Bun.stringWidth(char);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** The columns a whole string takes. */
|
|
33
|
+
export function textWidth(text: string): number {
|
|
34
|
+
let width = 0;
|
|
35
|
+
for (const char of graphemes(text)) width += displayWidth(char);
|
|
36
|
+
return width;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function isSpace(char: string): boolean {
|
|
40
|
+
return /^\s/u.test(char);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function tokensOf<T>(glyphs: readonly WrapGlyph<T>[]): WrapGlyph<T>[][] {
|
|
44
|
+
const tokens: WrapGlyph<T>[][] = [];
|
|
45
|
+
let current: WrapGlyph<T>[] = [];
|
|
46
|
+
let currentSpace: boolean | undefined;
|
|
47
|
+
for (const glyph of glyphs) {
|
|
48
|
+
const space = isSpace(glyph.char);
|
|
49
|
+
if (current.length > 0 && space !== currentSpace) {
|
|
50
|
+
tokens.push(current);
|
|
51
|
+
current = [];
|
|
52
|
+
}
|
|
53
|
+
current.push(glyph);
|
|
54
|
+
currentSpace = space;
|
|
55
|
+
}
|
|
56
|
+
if (current.length > 0) tokens.push(current);
|
|
57
|
+
return tokens;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function widthOf<T>(glyphs: readonly WrapGlyph<T>[]): number {
|
|
61
|
+
let width = 0;
|
|
62
|
+
for (const glyph of glyphs) width += displayWidth(glyph.char);
|
|
63
|
+
return width;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Cuts a word wider than a row into rows of at most `limit` columns. */
|
|
67
|
+
function cut<T>(
|
|
68
|
+
token: readonly WrapGlyph<T>[],
|
|
69
|
+
limit: number,
|
|
70
|
+
): { readonly full: WrapGlyph<T>[][]; readonly rest: WrapGlyph<T>[]; readonly used: number } {
|
|
71
|
+
const full: WrapGlyph<T>[][] = [];
|
|
72
|
+
let row: WrapGlyph<T>[] = [];
|
|
73
|
+
let used = 0;
|
|
74
|
+
for (const glyph of token) {
|
|
75
|
+
const width = displayWidth(glyph.char);
|
|
76
|
+
// A glyph wider than the whole row still goes on a row of its own.
|
|
77
|
+
if (used > 0 && used + width > limit) {
|
|
78
|
+
full.push(row);
|
|
79
|
+
row = [];
|
|
80
|
+
used = 0;
|
|
81
|
+
}
|
|
82
|
+
row.push(glyph);
|
|
83
|
+
used += width;
|
|
84
|
+
}
|
|
85
|
+
return { full, rest: row, used };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Breaks glyphs into the rows a terminal of `width` columns shows. A word moves
|
|
90
|
+
* whole to the next row when it fits there; one wider than a row is hard-cut.
|
|
91
|
+
*/
|
|
92
|
+
export function wrapGlyphs<T>(
|
|
93
|
+
glyphs: readonly WrapGlyph<T>[],
|
|
94
|
+
width: number,
|
|
95
|
+
): WrapGlyph<T>[][] {
|
|
96
|
+
const limit = Math.max(1, Math.trunc(width));
|
|
97
|
+
if (glyphs.length === 0) return [[]];
|
|
98
|
+
|
|
99
|
+
const lines: WrapGlyph<T>[][] = [];
|
|
100
|
+
let line: WrapGlyph<T>[] = [];
|
|
101
|
+
let used = 0;
|
|
102
|
+
const push = (): void => {
|
|
103
|
+
lines.push(line);
|
|
104
|
+
line = [];
|
|
105
|
+
used = 0;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
for (const token of tokensOf(glyphs)) {
|
|
109
|
+
if (isSpace(token[0]?.char ?? "")) {
|
|
110
|
+
for (const glyph of token) {
|
|
111
|
+
const size = displayWidth(glyph.char);
|
|
112
|
+
if (used + size > limit) {
|
|
113
|
+
if (line.some((current) => !isSpace(current.char))) push();
|
|
114
|
+
} else {
|
|
115
|
+
line.push(glyph);
|
|
116
|
+
used += size;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const size = widthOf(token);
|
|
123
|
+
if (used + size <= limit) {
|
|
124
|
+
line.push(...token);
|
|
125
|
+
used += size;
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (line.some((current) => !isSpace(current.char))) {
|
|
130
|
+
while (line.length > 0 && isSpace(line[line.length - 1]?.char ?? "")) {
|
|
131
|
+
const last = line.pop();
|
|
132
|
+
used -= displayWidth(last?.char ?? "");
|
|
133
|
+
}
|
|
134
|
+
push();
|
|
135
|
+
} else {
|
|
136
|
+
line = [];
|
|
137
|
+
used = 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const pieces = cut(token, limit);
|
|
141
|
+
lines.push(...pieces.full);
|
|
142
|
+
line = pieces.rest;
|
|
143
|
+
used = pieces.used;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
lines.push(line);
|
|
147
|
+
return lines;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The same wrapping for plain text, where only the row count and text matter. */
|
|
151
|
+
export function wrapText(text: string, width: number): string[] {
|
|
152
|
+
return wrapGlyphs(
|
|
153
|
+
graphemes(text).map((char) => ({ char, value: undefined })),
|
|
154
|
+
width,
|
|
155
|
+
).map((line) => line.map((glyph) => glyph.char).join(""));
|
|
156
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"title": "operad theme file",
|
|
4
|
+
"description": "A theme in themes/<name>.json of the operad home, or a theme shipped in packages/tui/themes. It names only the tokens it changes; extends fills the rest.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"properties": {
|
|
8
|
+
"$schema": {
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"comment": {
|
|
12
|
+
"description": "A note for people: where the colours come from, their licence, what was adjusted. It does nothing.",
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"extends": {
|
|
16
|
+
"description": "light, dark, terminal, the name of a shipped theme or the name of another theme file.",
|
|
17
|
+
"type": "string",
|
|
18
|
+
"minLength": 1,
|
|
19
|
+
"default": "dark"
|
|
20
|
+
},
|
|
21
|
+
"colors": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"additionalProperties": false,
|
|
24
|
+
"properties": {
|
|
25
|
+
"text": {
|
|
26
|
+
"oneOf": [
|
|
27
|
+
{
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "integer",
|
|
33
|
+
"minimum": 0,
|
|
34
|
+
"maximum": 15
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"weak": {
|
|
39
|
+
"oneOf": [
|
|
40
|
+
{
|
|
41
|
+
"type": "string",
|
|
42
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"type": "integer",
|
|
46
|
+
"minimum": 0,
|
|
47
|
+
"maximum": 15
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"rule": {
|
|
52
|
+
"oneOf": [
|
|
53
|
+
{
|
|
54
|
+
"type": "string",
|
|
55
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "integer",
|
|
59
|
+
"minimum": 0,
|
|
60
|
+
"maximum": 15
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"accent": {
|
|
65
|
+
"oneOf": [
|
|
66
|
+
{
|
|
67
|
+
"type": "string",
|
|
68
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"type": "integer",
|
|
72
|
+
"minimum": 0,
|
|
73
|
+
"maximum": 15
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
"run": {
|
|
78
|
+
"oneOf": [
|
|
79
|
+
{
|
|
80
|
+
"type": "string",
|
|
81
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"type": "integer",
|
|
85
|
+
"minimum": 0,
|
|
86
|
+
"maximum": 15
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"ok": {
|
|
91
|
+
"oneOf": [
|
|
92
|
+
{
|
|
93
|
+
"type": "string",
|
|
94
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"type": "integer",
|
|
98
|
+
"minimum": 0,
|
|
99
|
+
"maximum": 15
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
"error": {
|
|
104
|
+
"oneOf": [
|
|
105
|
+
{
|
|
106
|
+
"type": "string",
|
|
107
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "integer",
|
|
111
|
+
"minimum": 0,
|
|
112
|
+
"maximum": 15
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
"cancelled": {
|
|
117
|
+
"oneOf": [
|
|
118
|
+
{
|
|
119
|
+
"type": "string",
|
|
120
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "integer",
|
|
124
|
+
"minimum": 0,
|
|
125
|
+
"maximum": 15
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"add": {
|
|
130
|
+
"oneOf": [
|
|
131
|
+
{
|
|
132
|
+
"type": "string",
|
|
133
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"type": "integer",
|
|
137
|
+
"minimum": 0,
|
|
138
|
+
"maximum": 15
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
"remove": {
|
|
143
|
+
"oneOf": [
|
|
144
|
+
{
|
|
145
|
+
"type": "string",
|
|
146
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"type": "integer",
|
|
150
|
+
"minimum": 0,
|
|
151
|
+
"maximum": 15
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"tint": {
|
|
156
|
+
"oneOf": [
|
|
157
|
+
{
|
|
158
|
+
"type": "string",
|
|
159
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"type": "integer",
|
|
163
|
+
"minimum": 0,
|
|
164
|
+
"maximum": 15
|
|
165
|
+
}
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"code": {
|
|
169
|
+
"oneOf": [
|
|
170
|
+
{
|
|
171
|
+
"type": "string",
|
|
172
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"type": "integer",
|
|
176
|
+
"minimum": 0,
|
|
177
|
+
"maximum": 15
|
|
178
|
+
}
|
|
179
|
+
]
|
|
180
|
+
},
|
|
181
|
+
"background": {
|
|
182
|
+
"oneOf": [
|
|
183
|
+
{
|
|
184
|
+
"type": "string",
|
|
185
|
+
"pattern": "^#[0-9a-fA-F]{6}$"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"type": "integer",
|
|
189
|
+
"minimum": 0,
|
|
190
|
+
"maximum": 15
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Catppuccin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Dracula Theme
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 GitHub Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Tommaso Laurenzi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-present Sven Greb <development@svengreb.de> (https://www.svengreb.de)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2016 GitHub Inc.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) mvllow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2011 Ethan Schoonover
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
20
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018-present Enkia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/themes/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Shipped themes
|
|
2
|
+
|
|
3
|
+
Theme files in the format of `~/.operad/themes` (schema: `../theme.schema.json`),
|
|
4
|
+
built in to the TUI. A file of the same name in the operad home is refused. The
|
|
5
|
+
`comment` field of each file repeats the source, the licence, which upstream
|
|
6
|
+
colour each token takes and every adjustment made.
|
|
7
|
+
|
|
8
|
+
| Theme | Palette | Source | Licence | Adjusted |
|
|
9
|
+
|---|---|---|---|---|
|
|
10
|
+
| `catppuccin-latte` | Catppuccin Latte | https://github.com/catppuccin/palette | MIT, Copyright (c) 2021 Catppuccin (`LICENSE-catppuccin`) | yes |
|
|
11
|
+
| `catppuccin-frappe` | Catppuccin Frappe | https://github.com/catppuccin/palette | MIT, Copyright (c) 2021 Catppuccin (`LICENSE-catppuccin`) | no |
|
|
12
|
+
| `catppuccin-macchiato` | Catppuccin Macchiato | https://github.com/catppuccin/palette | MIT, Copyright (c) 2021 Catppuccin (`LICENSE-catppuccin`) | no |
|
|
13
|
+
| `catppuccin-mocha` | Catppuccin Mocha | https://github.com/catppuccin/palette | MIT, Copyright (c) 2021 Catppuccin (`LICENSE-catppuccin`) | no |
|
|
14
|
+
| `dracula` | Dracula | https://github.com/dracula/dracula-theme | MIT, Copyright (c) 2023 Dracula Theme (`LICENSE-dracula`) | no |
|
|
15
|
+
| `nord` | Nord | https://github.com/nordtheme/nord | MIT, Copyright (c) 2016-present Sven Greb (`LICENSE-nord`) | yes |
|
|
16
|
+
| `solarized-light` | Solarized Light | https://github.com/altercation/solarized | MIT, Copyright (c) 2011 Ethan Schoonover (`LICENSE-solarized`) | yes |
|
|
17
|
+
| `solarized-dark` | Solarized Dark | https://github.com/altercation/solarized | MIT, Copyright (c) 2011 Ethan Schoonover (`LICENSE-solarized`) | yes |
|
|
18
|
+
| `tokyo-night-day` | Tokyo Night Day | https://github.com/tokyo-night/tokyo-night-vscode-theme | MIT, Copyright (c) 2018-present Enkia (`LICENSE-tokyo-night`) | no |
|
|
19
|
+
| `tokyo-night-night` | Tokyo Night | https://github.com/tokyo-night/tokyo-night-vscode-theme | MIT, Copyright (c) 2018-present Enkia (`LICENSE-tokyo-night`) | yes |
|
|
20
|
+
| `one-light` | One Light | https://github.com/atom/one-light-syntax | MIT, Copyright (c) 2016 GitHub Inc. (`LICENSE-one`) | yes |
|
|
21
|
+
| `one-dark` | One Dark | https://github.com/atom/one-dark-syntax | MIT, Copyright (c) 2016 GitHub Inc. (`LICENSE-one`) | no |
|
|
22
|
+
| `rose-pine-dawn` | Rosé Pine Dawn | https://github.com/rose-pine/palette | MIT, Copyright (c) mvllow (`LICENSE-rose-pine`) | no |
|
|
23
|
+
| `rose-pine-main` | Rosé Pine | https://github.com/rose-pine/palette | MIT, Copyright (c) mvllow (`LICENSE-rose-pine`) | no |
|
|
24
|
+
| `github-light` | GitHub Light | https://github.com/primer/primitives | MIT, Copyright (c) 2018 GitHub Inc. (`LICENSE-github`) | no |
|
|
25
|
+
| `github-dark` | GitHub Dark | https://github.com/primer/primitives | MIT, Copyright (c) 2018 GitHub Inc. (`LICENSE-github`) | no |
|
|
26
|
+
| `kanagawa-lotus` | Kanagawa Lotus | https://github.com/rebelot/kanagawa.nvim | MIT, Copyright (c) 2021 Tommaso Laurenzi (`LICENSE-kanagawa`) | yes |
|
|
27
|
+
| `kanagawa-wave` | Kanagawa Wave | https://github.com/rebelot/kanagawa.nvim | MIT, Copyright (c) 2021 Tommaso Laurenzi (`LICENSE-kanagawa`) | no |
|
|
28
|
+
| `kanagawa-dragon` | Kanagawa Dragon | https://github.com/rebelot/kanagawa.nvim | MIT, Copyright (c) 2021 Tommaso Laurenzi (`LICENSE-kanagawa`) | no |
|
|
29
|
+
|
|
30
|
+
Each palette's licence text is bundled here as `LICENSE-<source>`, exactly as its
|
|
31
|
+
repository ships it. The `one-*` themes share `LICENSE-one` because
|
|
32
|
+
`atom/one-dark-syntax` and `atom/one-light-syntax` carry the same text.
|
|
33
|
+
|
|
34
|
+
## How a palette maps to the tokens
|
|
35
|
+
|
|
36
|
+
By role, as each project's own editor theme uses its colours: `accent` is the
|
|
37
|
+
purple or mauve, `run` the blue (cyan where the palette has no blue: Dracula;
|
|
38
|
+
foam in Rosé Pine), `ok` the green (pine in Rosé Pine), `error` the red,
|
|
39
|
+
`cancelled` that red darkened for a cancelled child's bar segment, `add`
|
|
40
|
+
and `remove` the green and red of its diffs, `tint` its selection or highlight
|
|
41
|
+
background, `code` a second background (or the base itself where the palette
|
|
42
|
+
names only one) and `background` the palette's own base colour, which is the
|
|
43
|
+
colour the contrast check measures against (the terminal's own background is
|
|
44
|
+
unknown).
|
|
45
|
+
|
|
46
|
+
## Cross-check with the iOS app
|
|
47
|
+
|
|
48
|
+
The app's palettes (`radian-ios OperadApp/Theme/Palettes.swift`) are a
|
|
49
|
+
cross-check, not the source. Where a role differs, the file's `comment` says
|
|
50
|
+
why: Catppuccin Latte's `tint` is surface0 (PmenuSel), while the app's mantle is
|
|
51
|
+
the popup's base; Rosé Pine's `tint` is the editor's Visual blend and its `code`
|
|
52
|
+
the surface panel; and Kanagawa and Tokyo Night follow upstream `bg_visual` and
|
|
53
|
+
`list.activeSelectionBackground`, where the app's values are stale. The app also
|
|
54
|
+
adjusts every colour to 4.5:1, so its other values can differ where this project
|
|
55
|
+
needs only the token's stated ratio.
|
|
56
|
+
|
|
57
|
+
## Contrast
|
|
58
|
+
|
|
59
|
+
`test/heavy/popular-themes.test.ts` computes the WCAG contrast of each token against
|
|
60
|
+
`background`: `text` must reach 4.5:1; `weak`, `accent`, `run`, `ok`, `error`,
|
|
61
|
+
`add` and `remove` 3:1. `cancelled` is a dark red by design, so it is checked
|
|
62
|
+
apart from `error` and `weak` rather than against a text ratio. A colour that missed is lightened (dark palettes) or
|
|
63
|
+
darkened (light palettes) in whole-percent steps of HSL lightness until it
|
|
64
|
+
passes, and the file's `comment` says which token moved from which upstream colour
|
|
65
|
+
to which. Nothing else is changed. Upstream colours that pass are used as they
|
|
66
|
+
are, so a value can differ from the operad iPhone app's, which adjusts every
|
|
67
|
+
colour to 4.5:1.
|
|
68
|
+
|
|
69
|
+
## Names and families
|
|
70
|
+
|
|
71
|
+
A family follows the terminal's light or dark mode like `auto`. A family name is
|
|
72
|
+
never also a theme name, so every theme can still be chosen on its own: the
|
|
73
|
+
dark Tokyo Night is `tokyo-night-night` and the main Rosé Pine is
|
|
74
|
+
`rose-pine-main`. `tokyo-night-day` is the light variant that upstream calls
|
|
75
|
+
Tokyo Night Light. Families are declared in `../src/themes.ts`.
|
|
76
|
+
|
|
77
|
+
## Left out
|
|
78
|
+
|
|
79
|
+
Gruvbox is not shipped: `morhetz/gruvbox` has no licence file in its tree (its
|
|
80
|
+
README and `package.json` say MIT, but there is no licence text or copyright
|
|
81
|
+
line to bundle). It can be added when upstream adds one.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../theme.schema.json",
|
|
3
|
+
"comment": "Catppuccin Frappe. Source: https://github.com/catppuccin/palette (palette.json, frappe; version 1.8.0). Licence: MIT, Copyright (c) 2021 Catppuccin; the text is in LICENSE-catppuccin. Roles: text = text, weak = subtext0, rule = surface1, accent = mauve, run = blue, ok = green, error = red, add = green, remove = red, tint = surface0, code = mantle, background = base. No colour adjusted. cancelled = error with lightness 60% for a cancelled child's bar segment.",
|
|
4
|
+
"colors": {
|
|
5
|
+
"text": "#c6d0f5",
|
|
6
|
+
"weak": "#a5adce",
|
|
7
|
+
"rule": "#51576d",
|
|
8
|
+
"accent": "#ca9ee6",
|
|
9
|
+
"run": "#8caaee",
|
|
10
|
+
"ok": "#a6d189",
|
|
11
|
+
"error": "#e78284",
|
|
12
|
+
"cancelled": "#b62326",
|
|
13
|
+
"add": "#a6d189",
|
|
14
|
+
"remove": "#e78284",
|
|
15
|
+
"tint": "#414559",
|
|
16
|
+
"code": "#292c3c",
|
|
17
|
+
"background": "#303446"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../theme.schema.json",
|
|
3
|
+
"comment": "Catppuccin Latte. Source: https://github.com/catppuccin/palette (palette.json, latte; version 1.8.0). Licence: MIT, Copyright (c) 2021 Catppuccin; the text is in LICENSE-catppuccin. Roles: text = text, weak = subtext0, rule = surface1, accent = mauve, run = blue, ok = green, error = red, add = green, remove = red, tint = surface0 (PmenuSel), code = mantle, background = base. The iOS app uses mantle for its selected-row tint, but Catppuccin's own editor theme selects with surface0 and keeps mantle for the popup's base, so tint keeps surface0. Adjusted for contrast, nothing else changed: ok #40a02b (green) -> #3f9d2a: lightness 40% -> 39% for 3:1 on #eff1f5 (was 2.96:1); add #40a02b (green) -> #3f9d2a: lightness 40% -> 39% for 3:1 on #eff1f5 (was 2.96:1). cancelled = error with lightness 60% for a cancelled child's bar segment.",
|
|
4
|
+
"colors": {
|
|
5
|
+
"text": "#4c4f69",
|
|
6
|
+
"weak": "#6c6f85",
|
|
7
|
+
"rule": "#bcc0cc",
|
|
8
|
+
"accent": "#8839ef",
|
|
9
|
+
"run": "#1e66f5",
|
|
10
|
+
"ok": "#3f9d2a",
|
|
11
|
+
"error": "#d20f39",
|
|
12
|
+
"cancelled": "#7e0922",
|
|
13
|
+
"add": "#3f9d2a",
|
|
14
|
+
"remove": "#d20f39",
|
|
15
|
+
"tint": "#ccd0da",
|
|
16
|
+
"code": "#e6e9ef",
|
|
17
|
+
"background": "#eff1f5"
|
|
18
|
+
}
|
|
19
|
+
}
|