@wordpress/theme 0.2.0 → 0.2.1-next.16d95556a.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/README.md +5 -1
- package/bin/generate-primitive-tokens/index.ts +1 -1
- package/build/color-ramps/index.js +5 -5
- package/build/color-ramps/index.js.map +2 -2
- package/build/color-ramps/lib/default-ramps.js +154 -154
- package/build/color-ramps/lib/default-ramps.js.map +2 -2
- package/build/color-ramps/lib/index.js +16 -9
- package/build/color-ramps/lib/index.js.map +2 -2
- package/build/color-ramps/lib/types.js.map +1 -1
- package/build/use-theme-provider-styles.js +1 -4
- package/build/use-theme-provider-styles.js.map +2 -2
- package/build-module/color-ramps/index.js +5 -5
- package/build-module/color-ramps/index.js.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.js +154 -154
- package/build-module/color-ramps/lib/default-ramps.js.map +2 -2
- package/build-module/color-ramps/lib/index.js +16 -9
- package/build-module/color-ramps/lib/index.js.map +2 -2
- package/build-module/use-theme-provider-styles.js +1 -4
- package/build-module/use-theme-provider-styles.js.map +2 -2
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/types.d.ts +2 -4
- package/build-types/color-ramps/lib/types.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/color-ramps/stories/ramp-table.d.ts +2 -4
- package/build-types/color-ramps/stories/ramp-table.d.ts.map +1 -1
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/color-ramps/index.ts +5 -5
- package/src/color-ramps/lib/default-ramps.ts +154 -154
- package/src/color-ramps/lib/index.ts +26 -22
- package/src/color-ramps/lib/types.ts +2 -7
- package/src/color-ramps/stories/index.story.tsx +4 -1
- package/src/color-ramps/stories/ramp-table.tsx +15 -26
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +11717 -41231
- package/src/color-ramps/test/index.test.ts +2 -2
- package/src/use-theme-provider-styles.ts +1 -4
- package/tsconfig.bin.tsbuildinfo +1 -1
- package/tsconfig.src.tsbuildinfo +1 -1
|
@@ -10,190 +10,190 @@ export const DEFAULT_RAMPS: Record<
|
|
|
10
10
|
> = {
|
|
11
11
|
bg: {
|
|
12
12
|
ramp: {
|
|
13
|
-
surface2:
|
|
14
|
-
bgFill1:
|
|
15
|
-
fgFill:
|
|
16
|
-
bgFill2:
|
|
17
|
-
surface6:
|
|
18
|
-
surface5:
|
|
19
|
-
surface4:
|
|
20
|
-
surface3:
|
|
21
|
-
fgSurface4:
|
|
22
|
-
fgSurface3:
|
|
23
|
-
fgSurface2:
|
|
24
|
-
fgSurface1:
|
|
25
|
-
stroke3:
|
|
26
|
-
stroke4:
|
|
27
|
-
stroke2:
|
|
28
|
-
stroke1:
|
|
29
|
-
bgFillDark:
|
|
30
|
-
fgFillDark:
|
|
31
|
-
bgFillInverted2:
|
|
32
|
-
bgFillInverted1:
|
|
33
|
-
fgFillInverted:
|
|
34
|
-
surface1:
|
|
13
|
+
surface2: '#f8f8f8',
|
|
14
|
+
bgFill1: '#555',
|
|
15
|
+
fgFill: '#f0f0f0',
|
|
16
|
+
bgFill2: '#494949',
|
|
17
|
+
surface6: '#d3d3d3',
|
|
18
|
+
surface5: '#e3e3e3',
|
|
19
|
+
surface4: '#eaeaea',
|
|
20
|
+
surface3: '#fff',
|
|
21
|
+
fgSurface4: '#1e1e1e',
|
|
22
|
+
fgSurface3: '#6e6e6e',
|
|
23
|
+
fgSurface2: '#8b8b8b',
|
|
24
|
+
fgSurface1: '#ababab',
|
|
25
|
+
stroke3: '#8b8b8b',
|
|
26
|
+
stroke4: '#6d6d6d',
|
|
27
|
+
stroke2: '#adadad',
|
|
28
|
+
stroke1: '#cfcfcf',
|
|
29
|
+
bgFillDark: '#1e1e1e',
|
|
30
|
+
fgFillDark: '#f0f0f0',
|
|
31
|
+
bgFillInverted2: '#1e1e1e',
|
|
32
|
+
bgFillInverted1: '#2d2d2d',
|
|
33
|
+
fgFillInverted: '#f0f0f0',
|
|
34
|
+
surface1: '#f0f0f0',
|
|
35
35
|
},
|
|
36
36
|
direction: 'darker',
|
|
37
37
|
},
|
|
38
38
|
primary: {
|
|
39
39
|
ramp: {
|
|
40
|
-
bgFill1:
|
|
41
|
-
fgFill:
|
|
42
|
-
bgFill2:
|
|
43
|
-
surface2:
|
|
44
|
-
surface6:
|
|
45
|
-
surface5:
|
|
46
|
-
surface4:
|
|
47
|
-
surface3:
|
|
48
|
-
fgSurface4:
|
|
49
|
-
fgSurface3:
|
|
50
|
-
fgSurface2:
|
|
51
|
-
fgSurface1:
|
|
52
|
-
stroke3:
|
|
53
|
-
stroke4:
|
|
54
|
-
stroke2:
|
|
55
|
-
stroke1:
|
|
56
|
-
bgFillDark:
|
|
57
|
-
fgFillDark:
|
|
58
|
-
bgFillInverted2:
|
|
59
|
-
bgFillInverted1:
|
|
60
|
-
fgFillInverted:
|
|
61
|
-
surface1:
|
|
40
|
+
bgFill1: '#3858e9',
|
|
41
|
+
fgFill: '#eff0f2',
|
|
42
|
+
bgFill2: '#2e49da',
|
|
43
|
+
surface2: '#f6f8fc',
|
|
44
|
+
surface6: '#c7d3ef',
|
|
45
|
+
surface5: '#dce3f5',
|
|
46
|
+
surface4: '#e5ebf7',
|
|
47
|
+
surface3: '#fff',
|
|
48
|
+
fgSurface4: '#080071',
|
|
49
|
+
fgSurface3: '#3858e9',
|
|
50
|
+
fgSurface2: '#5881ff',
|
|
51
|
+
fgSurface1: '#84a9ff',
|
|
52
|
+
stroke3: '#3858e9',
|
|
53
|
+
stroke4: '#2337c8',
|
|
54
|
+
stroke2: '#6d83bf',
|
|
55
|
+
stroke1: '#91a2cf',
|
|
56
|
+
bgFillDark: '#1b1e26',
|
|
57
|
+
fgFillDark: '#eff0f2',
|
|
58
|
+
bgFillInverted2: '#1b1e26',
|
|
59
|
+
bgFillInverted1: '#12009f',
|
|
60
|
+
fgFillInverted: '#eff0f2',
|
|
61
|
+
surface1: '#edf0fa',
|
|
62
62
|
},
|
|
63
63
|
direction: 'darker',
|
|
64
64
|
},
|
|
65
65
|
info: {
|
|
66
66
|
ramp: {
|
|
67
|
-
bgFill1:
|
|
68
|
-
fgFill:
|
|
69
|
-
bgFill2:
|
|
70
|
-
surface2:
|
|
71
|
-
surface6:
|
|
72
|
-
surface5:
|
|
73
|
-
surface4:
|
|
74
|
-
surface3:
|
|
75
|
-
fgSurface4:
|
|
76
|
-
fgSurface3:
|
|
77
|
-
fgSurface2:
|
|
78
|
-
fgSurface1:
|
|
79
|
-
stroke3:
|
|
80
|
-
stroke4:
|
|
81
|
-
stroke2:
|
|
82
|
-
stroke1:
|
|
83
|
-
bgFillDark:
|
|
84
|
-
fgFillDark:
|
|
85
|
-
bgFillInverted2:
|
|
86
|
-
bgFillInverted1:
|
|
87
|
-
fgFillInverted:
|
|
88
|
-
surface1:
|
|
67
|
+
bgFill1: '#0090ff',
|
|
68
|
+
fgFill: '#1b1e23',
|
|
69
|
+
bgFill2: '#0081ef',
|
|
70
|
+
surface2: '#f5f9fd',
|
|
71
|
+
surface6: '#bed6f1',
|
|
72
|
+
surface5: '#d5e5f6',
|
|
73
|
+
surface4: '#e0ebf8',
|
|
74
|
+
surface3: '#fff',
|
|
75
|
+
fgSurface4: '#001758',
|
|
76
|
+
fgSurface3: '#006dd9',
|
|
77
|
+
fgSurface2: '#008cfb',
|
|
78
|
+
fgSurface1: '#53b1ff',
|
|
79
|
+
stroke3: '#006dd9',
|
|
80
|
+
stroke4: '#004eb8',
|
|
81
|
+
stroke2: '#5d8fc6',
|
|
82
|
+
stroke1: '#8aaed6',
|
|
83
|
+
bgFillDark: '#1b1e23',
|
|
84
|
+
fgFillDark: '#eff0f2',
|
|
85
|
+
bgFillInverted2: '#1b1e23',
|
|
86
|
+
bgFillInverted1: '#002675',
|
|
87
|
+
fgFillInverted: '#eff0f2',
|
|
88
|
+
surface1: '#eaf1fa',
|
|
89
89
|
},
|
|
90
90
|
direction: 'darker',
|
|
91
91
|
},
|
|
92
92
|
success: {
|
|
93
93
|
ramp: {
|
|
94
|
-
bgFill1:
|
|
95
|
-
fgFill:
|
|
96
|
-
bgFill2:
|
|
97
|
-
surface2:
|
|
98
|
-
surface6:
|
|
99
|
-
surface5:
|
|
100
|
-
surface4:
|
|
101
|
-
surface3:
|
|
102
|
-
fgSurface4:
|
|
103
|
-
fgSurface3:
|
|
104
|
-
fgSurface2:
|
|
105
|
-
fgSurface1:
|
|
106
|
-
stroke3:
|
|
107
|
-
stroke4:
|
|
108
|
-
stroke2:
|
|
109
|
-
stroke1:
|
|
110
|
-
bgFillDark:
|
|
111
|
-
fgFillDark:
|
|
112
|
-
bgFillInverted2:
|
|
113
|
-
bgFillInverted1:
|
|
114
|
-
fgFillInverted:
|
|
115
|
-
surface1:
|
|
94
|
+
bgFill1: '#4ab866',
|
|
95
|
+
fgFill: '#1b1f1c',
|
|
96
|
+
bgFill2: '#37a857',
|
|
97
|
+
surface2: '#f0fcf2',
|
|
98
|
+
surface6: '#7eea95',
|
|
99
|
+
surface5: '#b7f2c1',
|
|
100
|
+
surface4: '#cdf5d3',
|
|
101
|
+
surface3: '#fff',
|
|
102
|
+
fgSurface4: '#002b00',
|
|
103
|
+
fgSurface3: '#008031',
|
|
104
|
+
fgSurface2: '#2c9f4e',
|
|
105
|
+
fgSurface1: '#54c16f',
|
|
106
|
+
stroke3: '#008031',
|
|
107
|
+
stroke4: '#006314',
|
|
108
|
+
stroke2: '#61986b',
|
|
109
|
+
stroke1: '#77ba84',
|
|
110
|
+
bgFillDark: '#1b1f1c',
|
|
111
|
+
fgFillDark: '#edf2ed',
|
|
112
|
+
bgFillInverted2: '#1b1f1c',
|
|
113
|
+
bgFillInverted1: '#003800',
|
|
114
|
+
fgFillInverted: '#edf2ed',
|
|
115
|
+
surface1: '#ddf8e1',
|
|
116
116
|
},
|
|
117
117
|
direction: 'darker',
|
|
118
118
|
},
|
|
119
119
|
caution: {
|
|
120
120
|
ramp: {
|
|
121
|
-
bgFill1:
|
|
122
|
-
fgFill:
|
|
123
|
-
bgFill2:
|
|
124
|
-
surface2:
|
|
125
|
-
surface6:
|
|
126
|
-
surface5:
|
|
127
|
-
surface4:
|
|
128
|
-
surface3:
|
|
129
|
-
fgSurface4:
|
|
130
|
-
fgSurface3:
|
|
131
|
-
fgSurface2:
|
|
132
|
-
fgSurface1:
|
|
133
|
-
stroke3:
|
|
134
|
-
stroke4:
|
|
135
|
-
stroke2:
|
|
136
|
-
stroke1:
|
|
137
|
-
bgFillDark:
|
|
138
|
-
fgFillDark:
|
|
139
|
-
bgFillInverted2:
|
|
140
|
-
bgFillInverted1:
|
|
141
|
-
fgFillInverted:
|
|
142
|
-
surface1:
|
|
121
|
+
bgFill1: '#f0d149',
|
|
122
|
+
fgFill: '#1f1e1b',
|
|
123
|
+
bgFill2: '#ddbe30',
|
|
124
|
+
surface2: '#fdf9e7',
|
|
125
|
+
surface6: '#ecd367',
|
|
126
|
+
surface5: '#f5e399',
|
|
127
|
+
surface4: '#f8ebb5',
|
|
128
|
+
surface3: '#fff',
|
|
129
|
+
fgSurface4: '#291d00',
|
|
130
|
+
fgSurface3: '#876b00',
|
|
131
|
+
fgSurface2: '#a78900',
|
|
132
|
+
fgSurface1: '#c9aa00',
|
|
133
|
+
stroke3: '#876b00',
|
|
134
|
+
stroke4: '#675000',
|
|
135
|
+
stroke2: '#978c60',
|
|
136
|
+
stroke1: '#b8ab75',
|
|
137
|
+
bgFillDark: '#1f1e1b',
|
|
138
|
+
fgFillDark: '#f6f1da',
|
|
139
|
+
bgFillInverted2: '#1f1e1b',
|
|
140
|
+
bgFillInverted1: '#3a2b00',
|
|
141
|
+
fgFillInverted: '#f6f1da',
|
|
142
|
+
surface1: '#faf1cd',
|
|
143
143
|
},
|
|
144
144
|
direction: 'darker',
|
|
145
145
|
},
|
|
146
146
|
warning: {
|
|
147
147
|
ramp: {
|
|
148
|
-
bgFill1:
|
|
149
|
-
fgFill:
|
|
150
|
-
bgFill2:
|
|
151
|
-
surface2:
|
|
152
|
-
surface6:
|
|
153
|
-
surface5:
|
|
154
|
-
surface4:
|
|
155
|
-
surface3:
|
|
156
|
-
fgSurface4:
|
|
157
|
-
fgSurface3:
|
|
158
|
-
fgSurface2:
|
|
159
|
-
fgSurface1:
|
|
160
|
-
stroke3:
|
|
161
|
-
stroke4:
|
|
162
|
-
stroke2:
|
|
163
|
-
stroke1:
|
|
164
|
-
bgFillDark:
|
|
165
|
-
fgFillDark:
|
|
166
|
-
bgFillInverted2:
|
|
167
|
-
bgFillInverted1:
|
|
168
|
-
fgFillInverted:
|
|
169
|
-
surface1:
|
|
148
|
+
bgFill1: '#f0b849',
|
|
149
|
+
fgFill: '#1f1e1b',
|
|
150
|
+
bgFill2: '#dea633',
|
|
151
|
+
surface2: '#fdf7ee',
|
|
152
|
+
surface6: '#f1ce90',
|
|
153
|
+
surface5: '#f6e0bb',
|
|
154
|
+
surface4: '#f8e9cd',
|
|
155
|
+
surface3: '#fff',
|
|
156
|
+
fgSurface4: '#2f1800',
|
|
157
|
+
fgSurface3: '#976300',
|
|
158
|
+
fgSurface2: '#b78100',
|
|
159
|
+
fgSurface1: '#d9a22e',
|
|
160
|
+
stroke3: '#976300',
|
|
161
|
+
stroke4: '#754900',
|
|
162
|
+
stroke2: '#9f8860',
|
|
163
|
+
stroke1: '#c2a776',
|
|
164
|
+
bgFillDark: '#1f1e1b',
|
|
165
|
+
fgFillDark: '#f3f0e9',
|
|
166
|
+
bgFillInverted2: '#1f1e1b',
|
|
167
|
+
bgFillInverted1: '#432600',
|
|
168
|
+
fgFillInverted: '#f3f0e9',
|
|
169
|
+
surface1: '#faefdc',
|
|
170
170
|
},
|
|
171
171
|
direction: 'darker',
|
|
172
172
|
},
|
|
173
173
|
error: {
|
|
174
174
|
ramp: {
|
|
175
|
-
bgFill1:
|
|
176
|
-
fgFill:
|
|
177
|
-
bgFill2:
|
|
178
|
-
surface2:
|
|
179
|
-
surface6:
|
|
180
|
-
surface5:
|
|
181
|
-
surface4:
|
|
182
|
-
surface3:
|
|
183
|
-
fgSurface4:
|
|
184
|
-
fgSurface3:
|
|
185
|
-
fgSurface2:
|
|
186
|
-
fgSurface1:
|
|
187
|
-
stroke3:
|
|
188
|
-
stroke4:
|
|
189
|
-
stroke2:
|
|
190
|
-
stroke1:
|
|
191
|
-
bgFillDark:
|
|
192
|
-
fgFillDark:
|
|
193
|
-
bgFillInverted2:
|
|
194
|
-
bgFillInverted1:
|
|
195
|
-
fgFillInverted:
|
|
196
|
-
surface1:
|
|
175
|
+
bgFill1: '#cc1818',
|
|
176
|
+
fgFill: '#f2efef',
|
|
177
|
+
bgFill2: '#bc0001',
|
|
178
|
+
surface2: '#fdf6f5',
|
|
179
|
+
surface6: '#f5c9c2',
|
|
180
|
+
surface5: '#f9dcd8',
|
|
181
|
+
surface4: '#fae5e2',
|
|
182
|
+
surface3: '#fff',
|
|
183
|
+
fgSurface4: '#4a0000',
|
|
184
|
+
fgSurface3: '#cc1818',
|
|
185
|
+
fgSurface2: '#f84d41',
|
|
186
|
+
fgSurface1: '#ff8373',
|
|
187
|
+
stroke3: '#cc1818',
|
|
188
|
+
stroke4: '#a70000',
|
|
189
|
+
stroke2: '#ca675c',
|
|
190
|
+
stroke1: '#dc8e83',
|
|
191
|
+
bgFillDark: '#231c1b',
|
|
192
|
+
fgFillDark: '#f2efef',
|
|
193
|
+
bgFillInverted2: '#231c1b',
|
|
194
|
+
bgFillInverted1: '#680000',
|
|
195
|
+
fgFillInverted: '#f2efef',
|
|
196
|
+
surface1: '#fcedea',
|
|
197
197
|
},
|
|
198
198
|
direction: 'darker',
|
|
199
199
|
},
|
|
@@ -67,10 +67,8 @@ function calculateRamp( {
|
|
|
67
67
|
value: number;
|
|
68
68
|
};
|
|
69
69
|
} ) {
|
|
70
|
-
const rampResults = {} as Record<
|
|
71
|
-
|
|
72
|
-
{ color: string; warning: boolean }
|
|
73
|
-
>;
|
|
70
|
+
const rampResults = {} as Record< keyof Ramp, string >;
|
|
71
|
+
let warnings: string[] | undefined;
|
|
74
72
|
let maxDeficit = -Infinity;
|
|
75
73
|
let maxDeficitDirection: RampDirection = 'lighter';
|
|
76
74
|
let maxDeficitStep;
|
|
@@ -113,10 +111,7 @@ function calculateRamp( {
|
|
|
113
111
|
if ( candidateContrast >= adjustedTarget ) {
|
|
114
112
|
// Store the reused color
|
|
115
113
|
calculatedColors.set( stepName, candidateColor );
|
|
116
|
-
rampResults[ stepName ] =
|
|
117
|
-
color: getColorString( candidateColor ),
|
|
118
|
-
warning: false,
|
|
119
|
-
};
|
|
114
|
+
rampResults[ stepName ] = getColorString( candidateColor );
|
|
120
115
|
|
|
121
116
|
continue; // Skip to next step
|
|
122
117
|
}
|
|
@@ -193,14 +188,17 @@ function calculateRamp( {
|
|
|
193
188
|
calculatedColors.set( stepName, searchResults.color );
|
|
194
189
|
|
|
195
190
|
// Add to results
|
|
196
|
-
rampResults[ stepName ] =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
191
|
+
rampResults[ stepName ] = getColorString( searchResults.color );
|
|
192
|
+
|
|
193
|
+
if ( ! searchResults.reached && ! contrast.ignoreWhenAdjustingSeed ) {
|
|
194
|
+
warnings ??= [];
|
|
195
|
+
warnings.push( stepName );
|
|
196
|
+
}
|
|
201
197
|
}
|
|
198
|
+
|
|
202
199
|
return {
|
|
203
200
|
rampResults,
|
|
201
|
+
warnings,
|
|
204
202
|
maxDeficit,
|
|
205
203
|
maxDeficitDirection,
|
|
206
204
|
maxDeficitStep,
|
|
@@ -250,15 +248,20 @@ export function buildRamp(
|
|
|
250
248
|
const sortedSteps = sortByDependency( config );
|
|
251
249
|
|
|
252
250
|
// Calculate the ramp with the initial seed.
|
|
253
|
-
const {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
251
|
+
const {
|
|
252
|
+
rampResults,
|
|
253
|
+
warnings,
|
|
254
|
+
maxDeficit,
|
|
255
|
+
maxDeficitDirection,
|
|
256
|
+
maxDeficitStep,
|
|
257
|
+
} = calculateRamp( {
|
|
258
|
+
seed,
|
|
259
|
+
sortedSteps,
|
|
260
|
+
config,
|
|
261
|
+
mainDir,
|
|
262
|
+
oppDir,
|
|
263
|
+
pinLightness,
|
|
264
|
+
} );
|
|
262
265
|
|
|
263
266
|
let bestRamp = rampResults;
|
|
264
267
|
|
|
@@ -326,6 +329,7 @@ export function buildRamp(
|
|
|
326
329
|
|
|
327
330
|
return {
|
|
328
331
|
ramp: bestRamp,
|
|
332
|
+
warnings,
|
|
329
333
|
direction: mainDir,
|
|
330
334
|
};
|
|
331
335
|
}
|
|
@@ -79,12 +79,7 @@ export type RampStepConfig = {
|
|
|
79
79
|
export type RampConfig = Record< keyof Ramp, RampStepConfig >;
|
|
80
80
|
|
|
81
81
|
export type RampResult = {
|
|
82
|
-
ramp: Record<
|
|
83
|
-
|
|
84
|
-
{
|
|
85
|
-
color: string;
|
|
86
|
-
warning: boolean;
|
|
87
|
-
}
|
|
88
|
-
>;
|
|
82
|
+
ramp: Record< keyof Ramp, string >;
|
|
83
|
+
warnings?: string[];
|
|
89
84
|
direction: RampDirection;
|
|
90
85
|
};
|
|
@@ -224,14 +224,17 @@ export const SampleCombinations: StoryObj< typeof ColorGen > = {
|
|
|
224
224
|
value: background,
|
|
225
225
|
},
|
|
226
226
|
ramp: bgRamp.ramp,
|
|
227
|
+
warnings: bgRamp.warnings,
|
|
227
228
|
};
|
|
228
229
|
|
|
230
|
+
const primaryRamp = buildAccentRamp( primary, bgRamp );
|
|
229
231
|
const primaryRampObj = {
|
|
230
232
|
seed: {
|
|
231
233
|
name: 'bgFill1' as const,
|
|
232
234
|
value: primary,
|
|
233
235
|
},
|
|
234
|
-
ramp:
|
|
236
|
+
ramp: primaryRamp.ramp,
|
|
237
|
+
warnings: primaryRamp.warnings,
|
|
235
238
|
};
|
|
236
239
|
|
|
237
240
|
return [ bgRampObj, primaryRampObj ];
|
|
@@ -40,13 +40,8 @@ type RampTableProps = {
|
|
|
40
40
|
name: keyof Ramp;
|
|
41
41
|
value: string;
|
|
42
42
|
};
|
|
43
|
-
ramp: Record<
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
color: string;
|
|
47
|
-
warning: boolean;
|
|
48
|
-
}
|
|
49
|
-
>;
|
|
43
|
+
ramp: Record< keyof Ramp, string >;
|
|
44
|
+
warnings?: string[];
|
|
50
45
|
}[];
|
|
51
46
|
};
|
|
52
47
|
export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
@@ -72,26 +67,26 @@ export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
|
72
67
|
padding: '8px 4px',
|
|
73
68
|
fontSize: 11,
|
|
74
69
|
fontWeight: 500,
|
|
75
|
-
color: ramps[ 0 ].ramp.fgSurface4
|
|
70
|
+
color: ramps[ 0 ].ramp.fgSurface4,
|
|
76
71
|
} }
|
|
77
72
|
>
|
|
78
73
|
{ abbr }
|
|
79
74
|
</div>
|
|
80
75
|
) ) }
|
|
81
|
-
{ ramps.map( ( { seed, ramp }, i ) =>
|
|
76
|
+
{ ramps.map( ( { seed, ramp, warnings = [] }, i ) =>
|
|
82
77
|
RAMP_TOKENS_ORDER.map( ( { tokenName } ) => (
|
|
83
78
|
<div
|
|
84
79
|
key={ `${ seed }-${ i }-${ tokenName }` }
|
|
85
80
|
style={ {
|
|
86
81
|
marginBlockStart: i !== 0 ? 4 : 0,
|
|
87
|
-
backgroundColor: ramp[ tokenName ]
|
|
82
|
+
backgroundColor: ramp[ tokenName ],
|
|
88
83
|
display: 'grid',
|
|
89
84
|
gridTemplateRows: '20px 1fr',
|
|
90
85
|
placeItems: 'center',
|
|
91
86
|
height: tokenName === seed.name ? 60 : 40,
|
|
92
87
|
minWidth: 32,
|
|
93
88
|
fontSize: 14,
|
|
94
|
-
outline:
|
|
89
|
+
outline: warnings.includes( tokenName )
|
|
95
90
|
? '2px solid red'
|
|
96
91
|
: '',
|
|
97
92
|
outlineOffset: '-2px',
|
|
@@ -111,8 +106,8 @@ export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
|
111
106
|
fontWeight: 500,
|
|
112
107
|
color:
|
|
113
108
|
tokenName === 'surface2'
|
|
114
|
-
? ramp.fgSurface4
|
|
115
|
-
: ramp.fgFill
|
|
109
|
+
? ramp.fgSurface4
|
|
110
|
+
: ramp.fgFill,
|
|
116
111
|
} }
|
|
117
112
|
>
|
|
118
113
|
SEED
|
|
@@ -139,32 +134,28 @@ export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
|
139
134
|
<>
|
|
140
135
|
<span
|
|
141
136
|
style={ {
|
|
142
|
-
color: ramp.fgSurface1
|
|
143
|
-
.color,
|
|
137
|
+
color: ramp.fgSurface1,
|
|
144
138
|
} }
|
|
145
139
|
>
|
|
146
140
|
Aa
|
|
147
141
|
</span>
|
|
148
142
|
<span
|
|
149
143
|
style={ {
|
|
150
|
-
color: ramp.fgSurface2
|
|
151
|
-
.color,
|
|
144
|
+
color: ramp.fgSurface2,
|
|
152
145
|
} }
|
|
153
146
|
>
|
|
154
147
|
Aa
|
|
155
148
|
</span>
|
|
156
149
|
<span
|
|
157
150
|
style={ {
|
|
158
|
-
color: ramp.fgSurface3
|
|
159
|
-
.color,
|
|
151
|
+
color: ramp.fgSurface3,
|
|
160
152
|
} }
|
|
161
153
|
>
|
|
162
154
|
Aa
|
|
163
155
|
</span>
|
|
164
156
|
<span
|
|
165
157
|
style={ {
|
|
166
|
-
color: ramp.fgSurface4
|
|
167
|
-
.color,
|
|
158
|
+
color: ramp.fgSurface4,
|
|
168
159
|
} }
|
|
169
160
|
>
|
|
170
161
|
Aa
|
|
@@ -174,7 +165,7 @@ export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
|
174
165
|
{ tokenName === 'bgFill1' ? (
|
|
175
166
|
<span
|
|
176
167
|
style={ {
|
|
177
|
-
color: ramp.fgFill
|
|
168
|
+
color: ramp.fgFill,
|
|
178
169
|
} }
|
|
179
170
|
>
|
|
180
171
|
Aa
|
|
@@ -183,8 +174,7 @@ export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
|
183
174
|
{ tokenName === 'bgFillInverted1' ? (
|
|
184
175
|
<span
|
|
185
176
|
style={ {
|
|
186
|
-
color: ramp.fgFillInverted
|
|
187
|
-
.color,
|
|
177
|
+
color: ramp.fgFillInverted,
|
|
188
178
|
} }
|
|
189
179
|
>
|
|
190
180
|
Aa
|
|
@@ -193,8 +183,7 @@ export const RampTable = forwardRef< HTMLDivElement, RampTableProps >(
|
|
|
193
183
|
{ tokenName === 'bgFillDark' ? (
|
|
194
184
|
<span
|
|
195
185
|
style={ {
|
|
196
|
-
color: ramp.fgFillDark
|
|
197
|
-
.color,
|
|
186
|
+
color: ramp.fgFillDark,
|
|
198
187
|
} }
|
|
199
188
|
>
|
|
200
189
|
Aa
|