@astryxdesign/theme-gothic 0.7.3 → 0.7.4-canary.28b1cd4

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.
@@ -0,0 +1,271 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ // Generated by astryx-oklch-v1. Review before committing.
4
+ export const black = '#000000' as const;
5
+ export const white = '#ffffff' as const;
6
+
7
+ // prettier-ignore
8
+ export const palette = {
9
+ "neutral": {
10
+ "name": "Gothic Neutral",
11
+ "dark": {
12
+ "0": "#000000",
13
+ "5": "#0b0d0d",
14
+ "10": "#101314",
15
+ "15": "#191d20",
16
+ "20": "#24292d",
17
+ "25": "#2d3338",
18
+ "30": "#363c42",
19
+ "35": "#3e454b",
20
+ "40": "#495056",
21
+ "45": "#545b62",
22
+ "50": "#5e676e",
23
+ "55": "#687279",
24
+ "60": "#737d86",
25
+ "65": "#7e8791",
26
+ "70": "#8a939e",
27
+ "75": "#96a0ab",
28
+ "80": "#a7b1bb",
29
+ "85": "#bec8cf",
30
+ "90": "#d5dfe5",
31
+ "95": "#e8f1f6",
32
+ "100": "#ffffff"
33
+ }
34
+ },
35
+ "red": {
36
+ "name": "Blood Crimson",
37
+ "dark": {
38
+ "0": "#000000",
39
+ "5": "#220806",
40
+ "10": "#30110d",
41
+ "15": "#3c1c17",
42
+ "20": "#4a2520",
43
+ "25": "#54302a",
44
+ "30": "#5e3a35",
45
+ "35": "#6b4540",
46
+ "40": "#77514c",
47
+ "45": "#825e59",
48
+ "50": "#8d6a66",
49
+ "55": "#987774",
50
+ "60": "#a48581",
51
+ "65": "#b0908c",
52
+ "70": "#bb9996",
53
+ "75": "#c6a6a2",
54
+ "80": "#d5b5b1",
55
+ "85": "#e8c4c0",
56
+ "90": "#f2d8d5",
57
+ "95": "#fbece9",
58
+ "100": "#ffffff"
59
+ }
60
+ },
61
+ "orange": {
62
+ "name": "Rust Copper",
63
+ "dark": {
64
+ "0": "#000000",
65
+ "5": "#270a01",
66
+ "10": "#411904",
67
+ "15": "#5a2a0a",
68
+ "20": "#6e3812",
69
+ "25": "#7d4015",
70
+ "30": "#8a4818",
71
+ "35": "#955425",
72
+ "40": "#9e6136",
73
+ "45": "#a36f49",
74
+ "50": "#a77c5a",
75
+ "55": "#ae896d",
76
+ "60": "#b6987d",
77
+ "65": "#c0a387",
78
+ "70": "#caac8e",
79
+ "75": "#d3b89a",
80
+ "80": "#e0c5a9",
81
+ "85": "#edd2b5",
82
+ "90": "#fbdfc1",
83
+ "95": "#feefde",
84
+ "100": "#ffffff"
85
+ }
86
+ },
87
+ "yellow": {
88
+ "name": "Aged Gold",
89
+ "dark": {
90
+ "0": "#000000",
91
+ "5": "#211301",
92
+ "10": "#3b2904",
93
+ "15": "#573f0b",
94
+ "20": "#6c5010",
95
+ "25": "#795b12",
96
+ "30": "#876515",
97
+ "35": "#93701b",
98
+ "40": "#9b7b28",
99
+ "45": "#a1853e",
100
+ "50": "#a68f52",
101
+ "55": "#ad9a64",
102
+ "60": "#b6a775",
103
+ "65": "#e6b85e",
104
+ "70": "#dec074",
105
+ "75": "#d3c490",
106
+ "80": "#dfd1a0",
107
+ "85": "#e9dcae",
108
+ "90": "#f3e7bc",
109
+ "95": "#fcf2cf",
110
+ "100": "#ffffff"
111
+ }
112
+ },
113
+ "green": {
114
+ "name": "Forest Moss",
115
+ "dark": {
116
+ "0": "#000000",
117
+ "5": "#071607",
118
+ "10": "#10250f",
119
+ "15": "#1a3419",
120
+ "20": "#244023",
121
+ "25": "#2e4f27",
122
+ "30": "#3a5e2c",
123
+ "35": "#476a37",
124
+ "40": "#567644",
125
+ "45": "#668254",
126
+ "50": "#768f63",
127
+ "55": "#869b72",
128
+ "60": "#96a880",
129
+ "65": "#9cb983",
130
+ "70": "#a3c987",
131
+ "75": "#b3c79a",
132
+ "80": "#c2d2ac",
133
+ "85": "#cfdebd",
134
+ "90": "#deeacf",
135
+ "95": "#ecf6e1",
136
+ "100": "#ffffff"
137
+ }
138
+ },
139
+ "teal": {
140
+ "name": "Verdigris",
141
+ "dark": {
142
+ "0": "#000000",
143
+ "5": "#011813",
144
+ "10": "#072922",
145
+ "15": "#103b33",
146
+ "20": "#174a40",
147
+ "25": "#1b5449",
148
+ "30": "#1f5e52",
149
+ "35": "#2a6b5c",
150
+ "40": "#3c7768",
151
+ "45": "#528175",
152
+ "50": "#648d80",
153
+ "55": "#76988d",
154
+ "60": "#86a499",
155
+ "65": "#82b5a6",
156
+ "70": "#7cc5b3",
157
+ "75": "#a3c2b6",
158
+ "80": "#b4cec5",
159
+ "85": "#c4dcd2",
160
+ "90": "#d2e9e0",
161
+ "95": "#e1f7ee",
162
+ "100": "#ffffff"
163
+ }
164
+ },
165
+ "cyan": {
166
+ "name": "Cathedral Mist",
167
+ "dark": {
168
+ "0": "#000000",
169
+ "5": "#021620",
170
+ "10": "#0b2834",
171
+ "15": "#183a47",
172
+ "20": "#204858",
173
+ "25": "#245367",
174
+ "30": "#2a5e75",
175
+ "35": "#366a82",
176
+ "40": "#45768c",
177
+ "45": "#568094",
178
+ "50": "#668c9d",
179
+ "55": "#7798a7",
180
+ "60": "#86a4b1",
181
+ "65": "#90afbc",
182
+ "70": "#98b8c5",
183
+ "75": "#a3c2cf",
184
+ "80": "#b1d0dc",
185
+ "85": "#beddea",
186
+ "90": "#caeaf7",
187
+ "95": "#e0f5fe",
188
+ "100": "#ffffff"
189
+ }
190
+ },
191
+ "blue": {
192
+ "name": "Midnight Indigo",
193
+ "dark": {
194
+ "0": "#000000",
195
+ "5": "#080f26",
196
+ "10": "#0f1937",
197
+ "15": "#162145",
198
+ "20": "#1f2c54",
199
+ "25": "#243462",
200
+ "30": "#2a3b6e",
201
+ "35": "#35487c",
202
+ "40": "#445789",
203
+ "45": "#556795",
204
+ "50": "#6677a0",
205
+ "55": "#7787ac",
206
+ "60": "#8696b8",
207
+ "65": "#8aa1d8",
208
+ "70": "#96acd7",
209
+ "75": "#a3b5d6",
210
+ "80": "#b2c3e3",
211
+ "85": "#c3d2ee",
212
+ "90": "#d6e1f6",
213
+ "95": "#eaf0fc",
214
+ "100": "#ffffff"
215
+ }
216
+ },
217
+ "purple": {
218
+ "name": "Cathedral Plum",
219
+ "dark": {
220
+ "0": "#000000",
221
+ "5": "#1a0822",
222
+ "10": "#2b0d35",
223
+ "15": "#391347",
224
+ "20": "#481b58",
225
+ "25": "#511f64",
226
+ "30": "#5a2370",
227
+ "35": "#65307c",
228
+ "40": "#6f3f86",
229
+ "45": "#784f8d",
230
+ "50": "#815f94",
231
+ "55": "#896f9b",
232
+ "60": "#947da6",
233
+ "65": "#9f87b0",
234
+ "70": "#a790ba",
235
+ "75": "#b29bc4",
236
+ "80": "#c39adb",
237
+ "85": "#d2ade9",
238
+ "90": "#e5c9f7",
239
+ "95": "#f4e7fc",
240
+ "100": "#ffffff"
241
+ }
242
+ },
243
+ "pink": {
244
+ "name": "Rose Madder",
245
+ "dark": {
246
+ "0": "#000000",
247
+ "5": "#280510",
248
+ "10": "#430d20",
249
+ "15": "#5c182f",
250
+ "20": "#71223c",
251
+ "25": "#7f2844",
252
+ "30": "#8d2d4c",
253
+ "35": "#983958",
254
+ "40": "#9d4863",
255
+ "45": "#9f556d",
256
+ "50": "#a16276",
257
+ "55": "#a37082",
258
+ "60": "#aa7d8e",
259
+ "65": "#d97580",
260
+ "70": "#d28897",
261
+ "75": "#c89aab",
262
+ "80": "#d7aaba",
263
+ "85": "#e8bbcc",
264
+ "90": "#f4d2de",
265
+ "95": "#fce9f0",
266
+ "100": "#ffffff"
267
+ }
268
+ }
269
+ } as const;
270
+
271
+ export default palette;
@@ -0,0 +1,63 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+ import {palette as gothicModePalettes} from './gothicPalettes.generated';
5
+ import {gothicPalettes} from './gothicTheme';
6
+
7
+ const stops = [
8
+ 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95,
9
+ 100,
10
+ ] as const;
11
+
12
+ const families = [
13
+ 'neutral',
14
+ 'blue',
15
+ 'cyan',
16
+ 'green',
17
+ 'orange',
18
+ 'pink',
19
+ 'purple',
20
+ 'red',
21
+ 'teal',
22
+ 'yellow',
23
+ ] as const;
24
+
25
+ describe('gothic palette artifact', () => {
26
+ it('preserves the existing public shape with every reviewed dark stop', () => {
27
+ expect(Object.keys(gothicPalettes)).toEqual(families);
28
+ for (const familyName of families) {
29
+ const family = gothicPalettes[familyName];
30
+ expect(typeof family.hue).toBe('number');
31
+ expect(typeof family.chroma).toBe('number');
32
+ for (const stop of stops) {
33
+ expect(family[stop]).toMatch(/^#[0-9a-f]{6}$/i);
34
+ }
35
+ expect(family[0]).toBe('#000000');
36
+ expect(family[100]).toBe('#ffffff');
37
+ }
38
+ });
39
+
40
+ it('keeps Gothic semantic, categorical, and syntax anchors exact', () => {
41
+ expect(gothicPalettes.neutral[10]).toBe('#101314');
42
+ expect(gothicPalettes.neutral[20]).toBe('#24292D');
43
+ expect(gothicPalettes.neutral[40]).toBe('#495056');
44
+ expect(gothicPalettes.neutral[75]).toBe('#96A0AB');
45
+ expect(gothicPalettes.neutral[95]).toBe('#E8F1F6');
46
+
47
+ expect(gothicModePalettes.purple.dark[80]).toBe('#c39adb');
48
+ expect(gothicModePalettes.green.dark[70]).toBe('#a3c987');
49
+ expect(gothicModePalettes.blue.dark[65]).toBe('#8aa1d8');
50
+ expect(gothicModePalettes.yellow.dark[65]).toBe('#e6b85e');
51
+ expect(gothicModePalettes.yellow.dark[70]).toBe('#dec074');
52
+ expect(gothicModePalettes.pink.dark[65]).toBe('#d97580');
53
+ expect(gothicModePalettes.teal.dark[70]).toBe('#7cc5b3');
54
+
55
+ for (const familyName of families.filter(family => family !== 'neutral')) {
56
+ const family = gothicModePalettes[familyName].dark;
57
+ expect(family[20]).toMatch(/^#[0-9a-f]{6}$/i);
58
+ expect(family[30]).toMatch(/^#[0-9a-f]{6}$/i);
59
+ expect(family[60]).toMatch(/^#[0-9a-f]{6}$/i);
60
+ expect(family[75]).toMatch(/^#[0-9a-f]{6}$/i);
61
+ }
62
+ });
63
+ });
@@ -0,0 +1,98 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {describe, expect, it} from 'vitest';
4
+ import {resolveThemeTokens} from '@astryxdesign/core/theme';
5
+ import {palette as gothicModePalettes} from './gothicPalettes.generated';
6
+ import {gothicTheme} from './gothicTheme';
7
+
8
+ const categoricalFamilies = [
9
+ 'blue',
10
+ 'cyan',
11
+ 'green',
12
+ 'orange',
13
+ 'pink',
14
+ 'purple',
15
+ 'red',
16
+ 'teal',
17
+ 'yellow',
18
+ ] as const;
19
+
20
+ function linearize(channel: number): number {
21
+ const value = channel / 255;
22
+ return value <= 0.04045
23
+ ? value / 12.92
24
+ : Math.pow((value + 0.055) / 1.055, 2.4);
25
+ }
26
+
27
+ function luminance(color: string): number {
28
+ const [red, green, blue] = [1, 3, 5].map(index =>
29
+ Number.parseInt(color.slice(index, index + 2), 16),
30
+ );
31
+ return (
32
+ 0.2126 * linearize(red) +
33
+ 0.7152 * linearize(green) +
34
+ 0.0722 * linearize(blue)
35
+ );
36
+ }
37
+
38
+ function contrast(foreground: string, background: string): number {
39
+ const [lighter, darker] = [luminance(foreground), luminance(background)].sort(
40
+ (left, right) => right - left,
41
+ );
42
+ return (lighter + 0.05) / (darker + 0.05);
43
+ }
44
+
45
+ describe('gothic palette mapping', () => {
46
+ it('keeps the theme dark-only and maps its neutral surface ladder', () => {
47
+ const tokens = resolveThemeTokens(gothicTheme, {mode: 'dark'});
48
+ const neutral = gothicModePalettes.neutral.dark;
49
+
50
+ expect(tokens['--color-background-body']).toBe(neutral[10]);
51
+ expect(tokens['--color-background-surface']).toBe(neutral[10]);
52
+ expect(tokens['--color-background-card']).toBe(neutral[15]);
53
+ expect(tokens['--color-background-popover']).toBe(neutral[20]);
54
+ expect(tokens['--color-text-primary']).toBe(neutral[95]);
55
+ expect(tokens['--color-text-secondary']).toBe(neutral[75]);
56
+ });
57
+
58
+ it('maps syntax roles to reviewed jewel-tone anchors with AA comments', () => {
59
+ const tokens = resolveThemeTokens(gothicTheme, {mode: 'dark'});
60
+ expect(tokens).toMatchObject({
61
+ '--color-syntax-keyword': gothicModePalettes.purple.dark[80],
62
+ '--color-syntax-string': gothicModePalettes.green.dark[70],
63
+ '--color-syntax-comment': gothicModePalettes.neutral.dark[65],
64
+ '--color-syntax-number': gothicModePalettes.yellow.dark[70],
65
+ '--color-syntax-function': gothicModePalettes.blue.dark[65],
66
+ '--color-syntax-type': gothicModePalettes.purple.dark[80],
67
+ '--color-syntax-constant': gothicModePalettes.yellow.dark[65],
68
+ '--color-syntax-tag': gothicModePalettes.pink.dark[65],
69
+ '--color-syntax-attribute': gothicModePalettes.yellow.dark[70],
70
+ '--color-syntax-property': gothicModePalettes.teal.dark[70],
71
+ '--color-syntax-added-marker': gothicModePalettes.green.dark[70],
72
+ '--color-syntax-removed-marker': gothicModePalettes.pink.dark[65],
73
+ });
74
+ expect(
75
+ contrast(
76
+ gothicModePalettes.neutral.dark[65],
77
+ gothicModePalettes.neutral.dark[10],
78
+ ),
79
+ 'syntax comment text',
80
+ ).toBeGreaterThanOrEqual(4.5);
81
+ });
82
+
83
+ it('maps every categorical role to the reviewed pattern with AA text', () => {
84
+ const tokens = resolveThemeTokens(gothicTheme, {mode: 'dark'});
85
+ for (const family of categoricalFamilies) {
86
+ const ramp = gothicModePalettes[family].dark;
87
+ const textStop = family === 'pink' || family === 'yellow' ? 15 : 20;
88
+ expect(tokens[`--color-background-${family}`]).toBe(ramp[75]);
89
+ expect(tokens[`--color-border-${family}`]).toBe(ramp[60]);
90
+ expect(tokens[`--color-icon-${family}`]).toBe(ramp[30]);
91
+ expect(tokens[`--color-text-${family}`]).toBe(ramp[textStop]);
92
+ expect(
93
+ contrast(ramp[textStop], ramp[75]),
94
+ `${family} categorical text`,
95
+ ).toBeGreaterThanOrEqual(4.5);
96
+ }
97
+ });
98
+ });