@udixio/theme 1.3.1 → 2.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/CHANGELOG.md +23 -2
- package/dist/API.d.ts +7 -4
- package/dist/API.d.ts.map +1 -1
- package/dist/app.container.d.ts +1 -2
- package/dist/app.container.d.ts.map +1 -1
- package/dist/bin.cjs +1 -1
- package/dist/bin.js +1 -1
- package/dist/browser.cjs +23 -18
- package/dist/browser.js +34 -29
- package/dist/color/color.api.d.ts +16 -31
- package/dist/color/color.api.d.ts.map +1 -1
- package/dist/color/color.d.ts +100 -0
- package/dist/color/color.d.ts.map +1 -0
- package/dist/color/color.manager.d.ts +9 -18
- package/dist/color/color.manager.d.ts.map +1 -1
- package/dist/color/color.utils.d.ts +14 -3
- package/dist/color/color.utils.d.ts.map +1 -1
- package/dist/color/default-color.d.ts +5 -1
- package/dist/color/default-color.d.ts.map +1 -1
- package/dist/color/index.d.ts +1 -1
- package/dist/color/index.d.ts.map +1 -1
- package/dist/config/config.interface.d.ts +4 -4
- package/dist/config/config.interface.d.ts.map +1 -1
- package/dist/context/context.d.ts +41 -0
- package/dist/context/context.d.ts.map +1 -0
- package/dist/context/context.module.d.ts +3 -0
- package/dist/context/context.module.d.ts.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/font.plugin-5Xpo-ntw.js +228 -0
- package/dist/font.plugin-FPU_gL1Y.cjs +227 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/{load-from-path-Bo1kCfh9.js → load-from-path-CBnO8ESw.js} +1 -1
- package/dist/{load-from-path-DoZnR1-p.cjs → load-from-path-kuofMGN3.cjs} +2 -2
- package/dist/loader/loader.d.ts +1 -1
- package/dist/loader/loader.d.ts.map +1 -1
- package/dist/loader-BzsrGBu-.cjs +3905 -0
- package/dist/loader-CoayTlSl.js +3906 -0
- package/dist/material-color-utilities/dynamic_color.d.ts +0 -22
- package/dist/material-color-utilities/dynamic_color.d.ts.map +1 -1
- package/dist/material-color-utilities/toneDeltaPair.d.ts +8 -8
- package/dist/material-color-utilities/toneDeltaPair.d.ts.map +1 -1
- package/dist/node.cjs +24 -19
- package/dist/node.js +36 -31
- package/dist/palette/index.d.ts +4 -0
- package/dist/palette/index.d.ts.map +1 -0
- package/dist/palette/palette.api.d.ts +13 -0
- package/dist/palette/palette.api.d.ts.map +1 -0
- package/dist/palette/palette.d.ts +33 -0
- package/dist/palette/palette.d.ts.map +1 -0
- package/dist/palette/palette.manager.d.ts +20 -0
- package/dist/palette/palette.manager.d.ts.map +1 -0
- package/dist/palette/palette.module.d.ts +3 -0
- package/dist/palette/palette.module.d.ts.map +1 -0
- package/dist/plugins/font/font.plugin.d.ts +1 -1
- package/dist/plugins/font/font.plugin.d.ts.map +1 -1
- package/dist/variant/index.d.ts +3 -0
- package/dist/variant/index.d.ts.map +1 -0
- package/dist/variant/variant.d.ts +31 -0
- package/dist/variant/variant.d.ts.map +1 -0
- package/dist/variant/variants/expressive.variant.d.ts +2 -0
- package/dist/variant/variants/expressive.variant.d.ts.map +1 -0
- package/dist/{theme → variant}/variants/index.d.ts +1 -1
- package/dist/variant/variants/index.d.ts.map +1 -0
- package/dist/variant/variants/neutral.variant.d.ts.map +1 -0
- package/dist/variant/variants/tonal-spot.variant.d.ts.map +1 -0
- package/dist/variant/variants/udixio.variant.d.ts +3 -0
- package/dist/variant/variants/udixio.variant.d.ts.map +1 -0
- package/dist/variant/variants/vibrant.variant.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/API.ts +12 -5
- package/src/app.container.ts +22 -11
- package/src/bootstrap.ts +1 -1
- package/src/color/color.api.ts +189 -47
- package/src/color/color.manager.ts +34 -189
- package/src/color/color.ts +295 -0
- package/src/color/color.utils.ts +48 -3
- package/src/color/default-color.ts +390 -425
- package/src/color/index.ts +1 -1
- package/src/config/config.interface.ts +5 -4
- package/src/context/context.module.ts +7 -0
- package/src/context/context.ts +169 -0
- package/src/context/index.ts +2 -0
- package/src/index.ts +6 -4
- package/src/loader/loader.ts +11 -24
- package/src/material-color-utilities/dynamic_color.ts +25 -34
- package/src/material-color-utilities/toneDeltaPair.ts +44 -41
- package/src/palette/index.ts +3 -0
- package/src/palette/palette.api.ts +43 -0
- package/src/palette/palette.manager.ts +74 -0
- package/src/palette/palette.module.ts +9 -0
- package/src/palette/palette.ts +206 -0
- package/src/plugins/font/font.plugin.ts +1 -1
- package/src/variant/index.ts +2 -0
- package/src/variant/variant.ts +84 -0
- package/src/{theme → variant}/variants/expressive.variant.ts +33 -29
- package/src/{theme → variant}/variants/index.ts +2 -2
- package/src/variant/variants/neutral.variant.ts +47 -0
- package/src/variant/variants/tonal-spot.variant.ts +37 -0
- package/src/variant/variants/udixio.variant.ts +846 -0
- package/src/{theme → variant}/variants/vibrant.variant.ts +23 -22
- package/dist/color/configurable-color.d.ts +0 -31
- package/dist/color/configurable-color.d.ts.map +0 -1
- package/dist/define-config-BasMdCqD.js +0 -430
- package/dist/define-config-CKSsLMnc.cjs +0 -429
- package/dist/loader-C8_TyOuS.js +0 -2698
- package/dist/loader-R7hccp8_.cjs +0 -2697
- package/dist/theme/index.d.ts +0 -8
- package/dist/theme/index.d.ts.map +0 -1
- package/dist/theme/scheme.d.ts +0 -20
- package/dist/theme/scheme.d.ts.map +0 -1
- package/dist/theme/scheme.manager.d.ts +0 -31
- package/dist/theme/scheme.manager.d.ts.map +0 -1
- package/dist/theme/theme.api.d.ts +0 -24
- package/dist/theme/theme.api.d.ts.map +0 -1
- package/dist/theme/theme.module.d.ts +0 -3
- package/dist/theme/theme.module.d.ts.map +0 -1
- package/dist/theme/variant.d.ts +0 -36
- package/dist/theme/variant.d.ts.map +0 -1
- package/dist/theme/variant.manager.d.ts +0 -14
- package/dist/theme/variant.manager.d.ts.map +0 -1
- package/dist/theme/variants/expressive.variant.d.ts +0 -3
- package/dist/theme/variants/expressive.variant.d.ts.map +0 -1
- package/dist/theme/variants/fidelity.variant.d.ts +0 -3
- package/dist/theme/variants/fidelity.variant.d.ts.map +0 -1
- package/dist/theme/variants/index.d.ts.map +0 -1
- package/dist/theme/variants/neutral.variant.d.ts.map +0 -1
- package/dist/theme/variants/tonal-spot.variant.d.ts.map +0 -1
- package/dist/theme/variants/vibrant.variant.d.ts.map +0 -1
- package/src/color/configurable-color.ts +0 -67
- package/src/theme/index.ts +0 -7
- package/src/theme/scheme.manager.ts +0 -100
- package/src/theme/scheme.ts +0 -66
- package/src/theme/theme.api.ts +0 -82
- package/src/theme/theme.module.ts +0 -11
- package/src/theme/variant.manager.ts +0 -58
- package/src/theme/variant.ts +0 -53
- package/src/theme/variants/fidelity.variant.ts +0 -38
- package/src/theme/variants/neutral.variant.ts +0 -45
- package/src/theme/variants/tonal-spot.variant.ts +0 -35
- /package/dist/{theme → variant}/variants/neutral.variant.d.ts +0 -0
- /package/dist/{theme → variant}/variants/tonal-spot.variant.d.ts +0 -0
- /package/dist/{theme → variant}/variants/vibrant.variant.d.ts +0 -0
|
@@ -0,0 +1,846 @@
|
|
|
1
|
+
import { getPiecewiseHue, getRotatedHue, variant, Variant } from '../variant';
|
|
2
|
+
import {
|
|
3
|
+
calculateToneAdjustmentPercentage,
|
|
4
|
+
DynamicColorKey,
|
|
5
|
+
getCurve,
|
|
6
|
+
tMaxC,
|
|
7
|
+
tMinC,
|
|
8
|
+
} from '../../color/color.utils';
|
|
9
|
+
import { Hct } from '../../material-color-utilities/htc';
|
|
10
|
+
import {
|
|
11
|
+
AddColorsOptions,
|
|
12
|
+
capitalizeFirstLetter,
|
|
13
|
+
Color,
|
|
14
|
+
ColorApi,
|
|
15
|
+
ColorFromPalette,
|
|
16
|
+
ColorManager,
|
|
17
|
+
getInitialToneFromBackground,
|
|
18
|
+
} from '../../color';
|
|
19
|
+
import { Contrast } from '@material/material-color-utilities';
|
|
20
|
+
import { toneDeltaPair } from '../../material-color-utilities';
|
|
21
|
+
import { Context } from '../../context';
|
|
22
|
+
import { API } from '../../API';
|
|
23
|
+
|
|
24
|
+
const surfaceContainerToneDelta = 2.5;
|
|
25
|
+
|
|
26
|
+
const inverseTone = (tone: number) => {
|
|
27
|
+
return 100 - tone;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const surfaceContainerTone = (
|
|
31
|
+
layer: number,
|
|
32
|
+
api: Pick<API, 'palettes' | 'context'>,
|
|
33
|
+
) => {
|
|
34
|
+
const t = surfaceContainerToneDelta * layer * (1 + api.context.contrastLevel);
|
|
35
|
+
if (api.context.isDark) {
|
|
36
|
+
return t * 1.5;
|
|
37
|
+
} else {
|
|
38
|
+
if (Hct.isYellow(api.palettes.get('neutral').hue)) {
|
|
39
|
+
return 100 - t - surfaceContainerToneDelta;
|
|
40
|
+
}
|
|
41
|
+
return 100 - t;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const highestSurface = (
|
|
46
|
+
context: Context,
|
|
47
|
+
colorService: ColorManager | ColorApi,
|
|
48
|
+
): Color => {
|
|
49
|
+
if (colorService instanceof ColorApi) {
|
|
50
|
+
return colorService.get('surface');
|
|
51
|
+
} else {
|
|
52
|
+
return colorService.get('surface');
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const udixioVariant: Variant = variant({
|
|
57
|
+
name: 'udixio',
|
|
58
|
+
palettes: {
|
|
59
|
+
primary: ({ sourceColor }) => ({
|
|
60
|
+
hue: sourceColor.hue,
|
|
61
|
+
chroma: sourceColor.chroma,
|
|
62
|
+
}),
|
|
63
|
+
secondary: ({ sourceColor }) => ({
|
|
64
|
+
hue: sourceColor.hue,
|
|
65
|
+
chroma: sourceColor.chroma / 1.4,
|
|
66
|
+
}),
|
|
67
|
+
tertiary: ({ sourceColor }) => ({
|
|
68
|
+
hue: getRotatedHue(
|
|
69
|
+
sourceColor,
|
|
70
|
+
[0, 20, 71, 161, 333, 360],
|
|
71
|
+
[-40, 48, -32, 40, -32],
|
|
72
|
+
),
|
|
73
|
+
chroma: sourceColor.chroma,
|
|
74
|
+
}),
|
|
75
|
+
neutral: ({ sourceColor }) => {
|
|
76
|
+
return {
|
|
77
|
+
hue: sourceColor.hue,
|
|
78
|
+
chroma: 5,
|
|
79
|
+
};
|
|
80
|
+
},
|
|
81
|
+
neutralVariant: ({ sourceColor }) => {
|
|
82
|
+
const neutral = 5;
|
|
83
|
+
return {
|
|
84
|
+
hue: sourceColor.hue,
|
|
85
|
+
chroma: neutral * 1.7,
|
|
86
|
+
};
|
|
87
|
+
},
|
|
88
|
+
error: ({ sourceColor }) => {
|
|
89
|
+
const errorHue = getPiecewiseHue(
|
|
90
|
+
sourceColor,
|
|
91
|
+
[0, 3, 13, 23, 33, 43, 153, 273, 360],
|
|
92
|
+
[12, 22, 32, 12, 22, 32, 22, 12],
|
|
93
|
+
);
|
|
94
|
+
return {
|
|
95
|
+
hue: errorHue,
|
|
96
|
+
chroma: 60,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
customPalettes: ({ sourceColor }, colorHct) => ({
|
|
101
|
+
hue: colorHct.hue,
|
|
102
|
+
chroma: sourceColor.chroma,
|
|
103
|
+
}),
|
|
104
|
+
|
|
105
|
+
colorsFromCustomPalette: (key: string) => {
|
|
106
|
+
const colorKey = key as DynamicColorKey;
|
|
107
|
+
// const colorDimKey = (colorKey + 'Dim') as DynamicColorKey;
|
|
108
|
+
const ColorKey = capitalizeFirstLetter(key);
|
|
109
|
+
const onColorKey = ('on' + ColorKey) as DynamicColorKey;
|
|
110
|
+
const colorContainerKey = (colorKey + 'Container') as DynamicColorKey;
|
|
111
|
+
const onColorContainerKey = ('on' +
|
|
112
|
+
ColorKey +
|
|
113
|
+
'Container') as DynamicColorKey;
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
115
|
+
// @ts-expect-error
|
|
116
|
+
// const inverseColorKey = ('inverse' + ColorKey) as DynamicColorKey;
|
|
117
|
+
// const colorFixedKey = (colorKey + 'Fixed') as DynamicColorKey;
|
|
118
|
+
// const colorFixedDimKey = (colorKey + 'FixedDim') as DynamicColorKey;
|
|
119
|
+
// const onColorFixedKey = ('on' + ColorKey + 'Fixed') as DynamicColorKey;
|
|
120
|
+
// const onColorFixedVariantKey = ('on' +
|
|
121
|
+
// ColorKey +
|
|
122
|
+
// 'FixedVariant') as DynamicColorKey;
|
|
123
|
+
const colors: AddColorsOptions = ({ palettes, colors, context: ctx }) => ({
|
|
124
|
+
[colorKey]: {
|
|
125
|
+
palette: () => palettes.get(colorKey),
|
|
126
|
+
tone: () => {
|
|
127
|
+
if (ctx.variant.name === 'neutral') {
|
|
128
|
+
return ctx.isDark
|
|
129
|
+
? tMinC(palettes.get(colorKey), 0, 98)
|
|
130
|
+
: tMaxC(palettes.get(colorKey));
|
|
131
|
+
} else if (ctx.variant.name === 'vibrant') {
|
|
132
|
+
return tMaxC(palettes.get(colorKey), 0, ctx.isDark ? 90 : 98);
|
|
133
|
+
} else {
|
|
134
|
+
return ctx.isDark ? 80 : tMaxC(palettes.get(colorKey));
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
isBackground: true,
|
|
138
|
+
background: () => highestSurface(ctx, colors),
|
|
139
|
+
contrastCurve: () => getCurve(4.5),
|
|
140
|
+
adjustTone: () =>
|
|
141
|
+
toneDeltaPair(
|
|
142
|
+
colors.get(colorContainerKey),
|
|
143
|
+
colors.get(colorKey),
|
|
144
|
+
5,
|
|
145
|
+
'relative_lighter',
|
|
146
|
+
true,
|
|
147
|
+
'farther',
|
|
148
|
+
),
|
|
149
|
+
},
|
|
150
|
+
// [colorDimKey]: {
|
|
151
|
+
// palette: () => palettes.get(colorKey),
|
|
152
|
+
// tone: () => {
|
|
153
|
+
// if (ctx.variant.name === 'neutral') {
|
|
154
|
+
// return 85;
|
|
155
|
+
// } else {
|
|
156
|
+
// return tMaxC(palettes.get(colorKey), 0, 90);
|
|
157
|
+
// }
|
|
158
|
+
// },
|
|
159
|
+
// isBackground: true,
|
|
160
|
+
// background: () => colors.get('surfaceContainerHigh'),
|
|
161
|
+
// contrastCurve: () => getCurve(4.5),
|
|
162
|
+
// adjustTone: () =>
|
|
163
|
+
// toneDeltaPair(
|
|
164
|
+
// colors.get(colorDimKey),
|
|
165
|
+
// colors.get(colorKey),
|
|
166
|
+
// 5,
|
|
167
|
+
// 'darker',
|
|
168
|
+
// true,
|
|
169
|
+
// 'farther',
|
|
170
|
+
// ),
|
|
171
|
+
// },
|
|
172
|
+
[onColorKey]: {
|
|
173
|
+
palette: () => palettes.get(colorKey),
|
|
174
|
+
background: () => colors.get(colorKey),
|
|
175
|
+
contrastCurve: () => getCurve(6),
|
|
176
|
+
},
|
|
177
|
+
[colorContainerKey]: {
|
|
178
|
+
palette: () => palettes.get(colorKey),
|
|
179
|
+
tone: () => {
|
|
180
|
+
if (ctx.variant.name === 'vibrant') {
|
|
181
|
+
return ctx.isDark
|
|
182
|
+
? tMinC(palettes.get(colorKey), 30, 40)
|
|
183
|
+
: tMaxC(palettes.get(colorKey), 84, 90);
|
|
184
|
+
} else if (ctx.variant.name === 'expressive') {
|
|
185
|
+
return ctx.isDark ? 15 : tMaxC(palettes.get(colorKey), 90, 95);
|
|
186
|
+
} else {
|
|
187
|
+
return ctx.isDark ? 25 : 90;
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
isBackground: true,
|
|
191
|
+
background: () => highestSurface(ctx, colors),
|
|
192
|
+
adjustTone: () => undefined,
|
|
193
|
+
contrastCurve: () =>
|
|
194
|
+
ctx.contrastLevel > 0 ? getCurve(1.5) : undefined,
|
|
195
|
+
},
|
|
196
|
+
[onColorContainerKey]: {
|
|
197
|
+
palette: () => palettes.get(colorKey),
|
|
198
|
+
background: () => colors.get(colorContainerKey),
|
|
199
|
+
contrastCurve: () => getCurve(6),
|
|
200
|
+
},
|
|
201
|
+
// [colorFixedKey]: {
|
|
202
|
+
// palette: () => palettes.get(colorKey),
|
|
203
|
+
// tone: () => {
|
|
204
|
+
// return ctx.temp({ isDark: false, contrastLevel: 0 }, () => {
|
|
205
|
+
// const color = colors.get(colorContainerKey);
|
|
206
|
+
// return color.getTone();
|
|
207
|
+
// });
|
|
208
|
+
// },
|
|
209
|
+
// isBackground: true,
|
|
210
|
+
// background: () => highestSurface(ctx, colors),
|
|
211
|
+
// contrastCurve: () =>
|
|
212
|
+
// ctx.contrastLevel > 0 ? getCurve(1.5) : undefined,
|
|
213
|
+
// },
|
|
214
|
+
// [colorFixedDimKey]: {
|
|
215
|
+
// palette: () => palettes.get(colorKey),
|
|
216
|
+
// tone: () => colors.get(colorFixedKey).getTone(),
|
|
217
|
+
// isBackground: true,
|
|
218
|
+
// adjustTone: () =>
|
|
219
|
+
// toneDeltaPair(
|
|
220
|
+
// colors.get(colorFixedDimKey),
|
|
221
|
+
// colors.get(colorFixedKey),
|
|
222
|
+
// 5,
|
|
223
|
+
// 'darker',
|
|
224
|
+
// true,
|
|
225
|
+
// 'exact',
|
|
226
|
+
// ),
|
|
227
|
+
// },
|
|
228
|
+
// [onColorFixedKey]: {
|
|
229
|
+
// palette: () => palettes.get(colorKey),
|
|
230
|
+
// background: () => this.get(colorFixedDimKey),
|
|
231
|
+
// contrastCurve: () => getCurve(7),
|
|
232
|
+
// },
|
|
233
|
+
// [onColorFixedVariantKey]: {
|
|
234
|
+
// palette: () => palettes.get(colorKey),
|
|
235
|
+
// background: () => colors.get(colorFixedDimKey),
|
|
236
|
+
// contrastCurve: () => getCurve(4.5),
|
|
237
|
+
// },
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
return colors;
|
|
241
|
+
},
|
|
242
|
+
colors: ({ colors, context: c, palettes }) => {
|
|
243
|
+
const getColor = (key: DynamicColorKey) => {
|
|
244
|
+
return colors.get(key);
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
return {
|
|
248
|
+
////////////////////////////////////////////////////////////////
|
|
249
|
+
// Surfaces [S] //
|
|
250
|
+
////////////////////////////////////////////////////////////////
|
|
251
|
+
surface: {
|
|
252
|
+
palette: () => palettes.get('neutral'),
|
|
253
|
+
tone: () => {
|
|
254
|
+
if (c.isDark) {
|
|
255
|
+
return 2;
|
|
256
|
+
} else {
|
|
257
|
+
return 99;
|
|
258
|
+
}
|
|
259
|
+
},
|
|
260
|
+
isBackground: true,
|
|
261
|
+
},
|
|
262
|
+
// surfaceDim: {
|
|
263
|
+
// palette: () => palettes.get('neutral'),
|
|
264
|
+
// tone: () => {
|
|
265
|
+
// if (c.isDark) {
|
|
266
|
+
// return 4;
|
|
267
|
+
// } else {
|
|
268
|
+
// if (Hct.isYellow(palettes.get('neutral').hue)) {
|
|
269
|
+
// return 90;
|
|
270
|
+
// } else if (c.variant.name === 'vibrant') {
|
|
271
|
+
// return 85;
|
|
272
|
+
// } else {
|
|
273
|
+
// return 87;
|
|
274
|
+
// }
|
|
275
|
+
// }
|
|
276
|
+
// },
|
|
277
|
+
// isBackground: true,
|
|
278
|
+
// chromaMultiplier: () => {
|
|
279
|
+
// if (!c.isDark) {
|
|
280
|
+
// if (c.variant.name === 'neutral') {
|
|
281
|
+
// return 2.5;
|
|
282
|
+
// } else if (c.variant.name === 'tonalSpot') {
|
|
283
|
+
// return 1.7;
|
|
284
|
+
// } else if (c.variant.name === 'expressive') {
|
|
285
|
+
// return Hct.isYellow(palettes.get('neutral').hue) ? 2.7 : 1.75;
|
|
286
|
+
// } else if (c.variant.name === 'vibrant') {
|
|
287
|
+
// return 1.36;
|
|
288
|
+
// }
|
|
289
|
+
// }
|
|
290
|
+
// return 1;
|
|
291
|
+
// },
|
|
292
|
+
// },
|
|
293
|
+
// surfaceBright: {
|
|
294
|
+
// palette: () => palettes.get('neutral'),
|
|
295
|
+
// tone: () => {
|
|
296
|
+
// if (c.isDark) {
|
|
297
|
+
// return 18;
|
|
298
|
+
// } else {
|
|
299
|
+
// if (Hct.isYellow(palettes.get('neutral').hue)) {
|
|
300
|
+
// return 99;
|
|
301
|
+
// } else if (c.variant.name === 'vibrant') {
|
|
302
|
+
// return 97;
|
|
303
|
+
// } else {
|
|
304
|
+
// return 98;
|
|
305
|
+
// }
|
|
306
|
+
// }
|
|
307
|
+
// },
|
|
308
|
+
// isBackground: true,
|
|
309
|
+
// chromaMultiplier: () => {
|
|
310
|
+
// if (c.isDark) {
|
|
311
|
+
// if (c.variant.name === 'neutral') {
|
|
312
|
+
// return 2.5;
|
|
313
|
+
// } else if (c.variant.name === 'tonalSpot') {
|
|
314
|
+
// return 1.7;
|
|
315
|
+
// } else if (c.variant.name === 'expressive') {
|
|
316
|
+
// return Hct.isYellow(palettes.get('neutral').hue) ? 2.7 : 1.75;
|
|
317
|
+
// } else if (c.variant.name === 'vibrant') {
|
|
318
|
+
// return 1.36;
|
|
319
|
+
// }
|
|
320
|
+
// }
|
|
321
|
+
// return 1;
|
|
322
|
+
// },
|
|
323
|
+
// },
|
|
324
|
+
surfaceContainerLowest: {
|
|
325
|
+
palette: () => palettes.get('neutral'),
|
|
326
|
+
tone: () => surfaceContainerTone(0, { palettes, context: c }),
|
|
327
|
+
isBackground: true,
|
|
328
|
+
},
|
|
329
|
+
surfaceContainerLow: {
|
|
330
|
+
palette: () => palettes.get('neutral'),
|
|
331
|
+
tone: () => surfaceContainerTone(1, { palettes, context: c }),
|
|
332
|
+
isBackground: true,
|
|
333
|
+
chromaMultiplier: () => {
|
|
334
|
+
return 1.25;
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
surfaceContainer: {
|
|
338
|
+
palette: () => palettes.get('neutral'),
|
|
339
|
+
tone: () => surfaceContainerTone(2, { palettes, context: c }),
|
|
340
|
+
isBackground: true,
|
|
341
|
+
chromaMultiplier: () => {
|
|
342
|
+
return 1.4;
|
|
343
|
+
},
|
|
344
|
+
},
|
|
345
|
+
surfaceContainerHigh: {
|
|
346
|
+
palette: () => palettes.get('neutral'),
|
|
347
|
+
tone: () => surfaceContainerTone(3, { palettes, context: c }),
|
|
348
|
+
isBackground: true,
|
|
349
|
+
chromaMultiplier: () => {
|
|
350
|
+
return 1.5;
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
surfaceContainerHighest: {
|
|
354
|
+
palette: () => palettes.get('neutral'),
|
|
355
|
+
tone: () => surfaceContainerTone(4, { palettes, context: c }),
|
|
356
|
+
isBackground: true,
|
|
357
|
+
chromaMultiplier: () => {
|
|
358
|
+
return 1.7;
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
onSurface: {
|
|
362
|
+
palette: () => palettes.get('neutral'),
|
|
363
|
+
tone: () => {
|
|
364
|
+
return getInitialToneFromBackground(highestSurface(c, colors));
|
|
365
|
+
},
|
|
366
|
+
chromaMultiplier: () => {
|
|
367
|
+
return 1.7;
|
|
368
|
+
},
|
|
369
|
+
background: () => highestSurface(c, colors),
|
|
370
|
+
contrastCurve: () => (c.isDark ? getCurve(11) : getCurve(9)),
|
|
371
|
+
},
|
|
372
|
+
onSurfaceVariant: {
|
|
373
|
+
palette: () => palettes.get('neutralVariant'),
|
|
374
|
+
chromaMultiplier: () => {
|
|
375
|
+
return 1.7;
|
|
376
|
+
},
|
|
377
|
+
background: () => highestSurface(c, colors),
|
|
378
|
+
contrastCurve: () => (c.isDark ? getCurve(6) : getCurve(4.5)),
|
|
379
|
+
},
|
|
380
|
+
outline: {
|
|
381
|
+
palette: () => palettes.get('neutralVariant'),
|
|
382
|
+
chromaMultiplier: () => {
|
|
383
|
+
return 1.7;
|
|
384
|
+
},
|
|
385
|
+
background: () => highestSurface(c, colors),
|
|
386
|
+
contrastCurve: () => getCurve(3),
|
|
387
|
+
},
|
|
388
|
+
outlineVariant: {
|
|
389
|
+
palette: () => palettes.get('neutralVariant'),
|
|
390
|
+
chromaMultiplier: () => {
|
|
391
|
+
return 1.7;
|
|
392
|
+
},
|
|
393
|
+
background: () => highestSurface(c, colors),
|
|
394
|
+
contrastCurve: () => getCurve(1.5),
|
|
395
|
+
},
|
|
396
|
+
inverseSurface: {
|
|
397
|
+
palette: () => palettes.get('neutral'),
|
|
398
|
+
tone: () => 100 - colors.get('surface').getTone(),
|
|
399
|
+
isBackground: true,
|
|
400
|
+
},
|
|
401
|
+
inverseOnSurface: {
|
|
402
|
+
palette: () => palettes.get('neutral'),
|
|
403
|
+
tone: () => (c.isDark ? 20 : 95),
|
|
404
|
+
background: () => colors.get('inverseSurface'),
|
|
405
|
+
contrastCurve: () => getCurve(7),
|
|
406
|
+
},
|
|
407
|
+
////////////////////////////////////////////////////////////////
|
|
408
|
+
// Primaries [P] //
|
|
409
|
+
////////////////////////////////////////////////////////////////
|
|
410
|
+
primary: {
|
|
411
|
+
palette: () => palettes.get('primary'),
|
|
412
|
+
tone: () => {
|
|
413
|
+
return c.sourceColor.tone;
|
|
414
|
+
},
|
|
415
|
+
isBackground: true,
|
|
416
|
+
background: () => highestSurface(c, colors),
|
|
417
|
+
contrastCurve: () => getCurve(4.5),
|
|
418
|
+
adjustTone: () => () => {
|
|
419
|
+
const surfaceTone = colors.get('surface').getTone();
|
|
420
|
+
const primaryTone = (colors.get('primary') as ColorFromPalette)
|
|
421
|
+
.options.tone;
|
|
422
|
+
let selfTone = primaryTone;
|
|
423
|
+
if (Contrast.ratioOfTones(surfaceTone, selfTone) < 3) {
|
|
424
|
+
const ratio = calculateToneAdjustmentPercentage(
|
|
425
|
+
surfaceTone,
|
|
426
|
+
selfTone,
|
|
427
|
+
3,
|
|
428
|
+
);
|
|
429
|
+
const inverseT = inverseTone(primaryTone);
|
|
430
|
+
selfTone = selfTone + (inverseT - selfTone) * ratio;
|
|
431
|
+
}
|
|
432
|
+
return selfTone;
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
// primaryDim: {
|
|
436
|
+
// palette: () => palettes.get('primary'),
|
|
437
|
+
// tone: () => {
|
|
438
|
+
// if (c.variant.name === 'neutral') {
|
|
439
|
+
// return 85;
|
|
440
|
+
// } else if (c.variant.name === 'tonalSpot') {
|
|
441
|
+
// return tMaxC(palettes.get('primary'), 0, 90);
|
|
442
|
+
// } else {
|
|
443
|
+
// return tMaxC(palettes.get('primary'));
|
|
444
|
+
// }
|
|
445
|
+
// },
|
|
446
|
+
// isBackground: true,
|
|
447
|
+
// background: () => getColor('surfaceContainerHigh'),
|
|
448
|
+
// contrastCurve: () => getCurve(4.5),
|
|
449
|
+
// adjustTone: () =>
|
|
450
|
+
// toneDeltaPair(
|
|
451
|
+
// colors.get('primaryDim'),
|
|
452
|
+
// colors.get('primary'),
|
|
453
|
+
// 5,
|
|
454
|
+
// 'darker',
|
|
455
|
+
// true,
|
|
456
|
+
// 'farther',
|
|
457
|
+
// ),
|
|
458
|
+
// },
|
|
459
|
+
onPrimary: {
|
|
460
|
+
palette: () => palettes.get('primary'),
|
|
461
|
+
background: () => colors.get('primary'),
|
|
462
|
+
contrastCurve: () => getCurve(6),
|
|
463
|
+
},
|
|
464
|
+
primaryContainer: {
|
|
465
|
+
palette: () => palettes.get('primary'),
|
|
466
|
+
tone: () => {
|
|
467
|
+
return c.isDark
|
|
468
|
+
? tMinC(palettes.get('primary'), 35, 93)
|
|
469
|
+
: tMaxC(palettes.get('primary'), 0, 90);
|
|
470
|
+
},
|
|
471
|
+
isBackground: true,
|
|
472
|
+
background: () => highestSurface(c, colors),
|
|
473
|
+
adjustTone: () =>
|
|
474
|
+
c.variant.name == 'fidelity'
|
|
475
|
+
? toneDeltaPair(
|
|
476
|
+
colors.get('primary'),
|
|
477
|
+
colors.get('primaryContainer'),
|
|
478
|
+
15,
|
|
479
|
+
'relative_darker',
|
|
480
|
+
true,
|
|
481
|
+
'farther',
|
|
482
|
+
)
|
|
483
|
+
: undefined,
|
|
484
|
+
contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
485
|
+
},
|
|
486
|
+
onPrimaryContainer: {
|
|
487
|
+
palette: () => palettes.get('primary'),
|
|
488
|
+
background: () => colors.get('primaryContainer'),
|
|
489
|
+
contrastCurve: () => getCurve(6),
|
|
490
|
+
},
|
|
491
|
+
|
|
492
|
+
// primaryFixed: {
|
|
493
|
+
// palette: () => palettes.get('primary'),
|
|
494
|
+
// tone: () => {
|
|
495
|
+
// return c.temp(
|
|
496
|
+
// {
|
|
497
|
+
// isDark: false,
|
|
498
|
+
// contrastLevel: 0,
|
|
499
|
+
// },
|
|
500
|
+
// () => {
|
|
501
|
+
// const color = getColor('primaryContainer');
|
|
502
|
+
// return color.getTone();
|
|
503
|
+
// },
|
|
504
|
+
// );
|
|
505
|
+
// },
|
|
506
|
+
// isBackground: true,
|
|
507
|
+
// background: () => highestSurface(c, colors),
|
|
508
|
+
// contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
509
|
+
// },
|
|
510
|
+
|
|
511
|
+
// primaryFixedDim: {
|
|
512
|
+
// palette: () => palettes.get('primary'),
|
|
513
|
+
// tone: () => colors.get('primaryFixed').getTone(),
|
|
514
|
+
// isBackground: true,
|
|
515
|
+
// adjustTone: () =>
|
|
516
|
+
// toneDeltaPair(
|
|
517
|
+
// getColor('primaryFixedDim'),
|
|
518
|
+
// getColor('primaryFixed'),
|
|
519
|
+
// 5,
|
|
520
|
+
// 'darker',
|
|
521
|
+
// true,
|
|
522
|
+
// 'exact',
|
|
523
|
+
// ),
|
|
524
|
+
// },
|
|
525
|
+
|
|
526
|
+
// onPrimaryFixed: {
|
|
527
|
+
// palette: () => palettes.get('primary'),
|
|
528
|
+
// background: () => colors.get('primaryFixedDim'),
|
|
529
|
+
// contrastCurve: () => getCurve(7),
|
|
530
|
+
// },
|
|
531
|
+
|
|
532
|
+
// onPrimaryFixedVariant: {
|
|
533
|
+
// palette: () => palettes.get('primary'),
|
|
534
|
+
// background: () => colors.get('primaryFixedDim'),
|
|
535
|
+
// contrastCurve: () => getCurve(4.5),
|
|
536
|
+
// },
|
|
537
|
+
|
|
538
|
+
inversePrimary: {
|
|
539
|
+
palette: () => palettes.get('primary'),
|
|
540
|
+
tone: () => tMaxC(palettes.get('primary')),
|
|
541
|
+
background: () => colors.get('inverseSurface'),
|
|
542
|
+
contrastCurve: () => getCurve(6),
|
|
543
|
+
},
|
|
544
|
+
////////////////////////////////////////////////////////////////
|
|
545
|
+
// Secondaries [Q] //
|
|
546
|
+
////////////////////////////////////////////////////////////////
|
|
547
|
+
secondary: {
|
|
548
|
+
palette: () => palettes.get('secondary'),
|
|
549
|
+
tone: () => {
|
|
550
|
+
return c.isDark ? 80 : tMaxC(palettes.get('secondary'));
|
|
551
|
+
},
|
|
552
|
+
isBackground: true,
|
|
553
|
+
background: () => highestSurface(c, colors),
|
|
554
|
+
contrastCurve: () => getCurve(4.5),
|
|
555
|
+
adjustTone: () =>
|
|
556
|
+
toneDeltaPair(
|
|
557
|
+
getColor('secondaryContainer'),
|
|
558
|
+
getColor('secondary'),
|
|
559
|
+
5,
|
|
560
|
+
'relative_lighter',
|
|
561
|
+
true,
|
|
562
|
+
'farther',
|
|
563
|
+
),
|
|
564
|
+
},
|
|
565
|
+
// secondaryDim: {
|
|
566
|
+
// palette: () => palettes.get('secondary'),
|
|
567
|
+
// tone: () => {
|
|
568
|
+
// if (c.variant.name === 'neutral') {
|
|
569
|
+
// return 85;
|
|
570
|
+
// } else {
|
|
571
|
+
// return tMaxC(palettes.get('secondary'), 0, 90);
|
|
572
|
+
// }
|
|
573
|
+
// },
|
|
574
|
+
// isBackground: true,
|
|
575
|
+
// background: () => getColor('surfaceContainerHigh'),
|
|
576
|
+
// contrastCurve: () => getCurve(4.5),
|
|
577
|
+
// adjustTone: () =>
|
|
578
|
+
// toneDeltaPair(
|
|
579
|
+
// getColor('secondaryDim'),
|
|
580
|
+
// getColor('secondary'),
|
|
581
|
+
// 5,
|
|
582
|
+
// 'darker',
|
|
583
|
+
// true,
|
|
584
|
+
// 'farther',
|
|
585
|
+
// ),
|
|
586
|
+
// },
|
|
587
|
+
onSecondary: {
|
|
588
|
+
palette: () => palettes.get('secondary'),
|
|
589
|
+
background: () => getColor('secondary'),
|
|
590
|
+
contrastCurve: () => getCurve(6),
|
|
591
|
+
},
|
|
592
|
+
secondaryContainer: {
|
|
593
|
+
palette: () => palettes.get('secondary'),
|
|
594
|
+
tone: () => {
|
|
595
|
+
return c.isDark ? 25 : 90;
|
|
596
|
+
},
|
|
597
|
+
isBackground: true,
|
|
598
|
+
background: () => highestSurface(c, colors),
|
|
599
|
+
adjustTone: () => undefined,
|
|
600
|
+
contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
601
|
+
},
|
|
602
|
+
onSecondaryContainer: {
|
|
603
|
+
palette: () => palettes.get('secondary'),
|
|
604
|
+
background: () => getColor('secondaryContainer'),
|
|
605
|
+
contrastCurve: () => getCurve(6),
|
|
606
|
+
},
|
|
607
|
+
|
|
608
|
+
// secondaryFixed: {
|
|
609
|
+
// palette: () => palettes.get('secondary'),
|
|
610
|
+
// tone: () => {
|
|
611
|
+
// return c.temp(
|
|
612
|
+
// {
|
|
613
|
+
// isDark: false,
|
|
614
|
+
// contrastLevel: 0,
|
|
615
|
+
// },
|
|
616
|
+
// () => {
|
|
617
|
+
// const color = getColor('secondaryContainer');
|
|
618
|
+
// return color.getTone();
|
|
619
|
+
// },
|
|
620
|
+
// );
|
|
621
|
+
// },
|
|
622
|
+
// isBackground: true,
|
|
623
|
+
// background: () => highestSurface(c, colors),
|
|
624
|
+
// contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
625
|
+
// },
|
|
626
|
+
|
|
627
|
+
// secondaryFixedDim: {
|
|
628
|
+
// palette: () => palettes.get('secondary'),
|
|
629
|
+
// tone: () => getColor('secondaryFixed').getTone(),
|
|
630
|
+
// isBackground: true,
|
|
631
|
+
// adjustTone: () =>
|
|
632
|
+
// toneDeltaPair(
|
|
633
|
+
// getColor('secondaryFixedDim'),
|
|
634
|
+
// getColor('secondaryFixed'),
|
|
635
|
+
// 5,
|
|
636
|
+
// 'darker',
|
|
637
|
+
// true,
|
|
638
|
+
// 'exact',
|
|
639
|
+
// ),
|
|
640
|
+
// },
|
|
641
|
+
|
|
642
|
+
// onSecondaryFixed: {
|
|
643
|
+
// palette: () => palettes.get('secondary'),
|
|
644
|
+
// background: () => getColor('secondaryFixedDim'),
|
|
645
|
+
// contrastCurve: () => getCurve(7),
|
|
646
|
+
// },
|
|
647
|
+
|
|
648
|
+
// onSecondaryFixedVariant: {
|
|
649
|
+
// palette: () => palettes.get('secondary'),
|
|
650
|
+
// background: () => getColor('secondaryFixedDim'),
|
|
651
|
+
// contrastCurve: () => getCurve(4.5),
|
|
652
|
+
// },
|
|
653
|
+
|
|
654
|
+
////////////////////////////////////////////////////////////////
|
|
655
|
+
// Tertiaries [T] //
|
|
656
|
+
////////////////////////////////////////////////////////////////
|
|
657
|
+
tertiary: {
|
|
658
|
+
palette: () => palettes.get('tertiary'),
|
|
659
|
+
tone: () => {
|
|
660
|
+
return c.isDark
|
|
661
|
+
? tMaxC(palettes.get('tertiary'), 0, 98)
|
|
662
|
+
: tMaxC(palettes.get('tertiary'));
|
|
663
|
+
},
|
|
664
|
+
isBackground: true,
|
|
665
|
+
background: () => highestSurface(c, colors),
|
|
666
|
+
contrastCurve: () => getCurve(4.5),
|
|
667
|
+
adjustTone: () =>
|
|
668
|
+
toneDeltaPair(
|
|
669
|
+
getColor('tertiaryContainer'),
|
|
670
|
+
getColor('tertiary'),
|
|
671
|
+
5,
|
|
672
|
+
'relative_lighter',
|
|
673
|
+
true,
|
|
674
|
+
'farther',
|
|
675
|
+
),
|
|
676
|
+
},
|
|
677
|
+
// tertiaryDim: {
|
|
678
|
+
// palette: () => palettes.get('tertiary'),
|
|
679
|
+
// tone: () => {
|
|
680
|
+
// if (c.variant.name === 'tonalSpot') {
|
|
681
|
+
// return tMaxC(palettes.get('tertiary'), 0, 90);
|
|
682
|
+
// } else {
|
|
683
|
+
// return tMaxC(palettes.get('tertiary'));
|
|
684
|
+
// }
|
|
685
|
+
// },
|
|
686
|
+
// isBackground: true,
|
|
687
|
+
// background: () => getColor('surfaceContainerHigh'),
|
|
688
|
+
// contrastCurve: () => getCurve(4.5),
|
|
689
|
+
// adjustTone: () =>
|
|
690
|
+
// toneDeltaPair(
|
|
691
|
+
// getColor('tertiaryDim'),
|
|
692
|
+
// getColor('tertiary'),
|
|
693
|
+
// 5,
|
|
694
|
+
// 'darker',
|
|
695
|
+
// true,
|
|
696
|
+
// 'farther',
|
|
697
|
+
// ),
|
|
698
|
+
// },
|
|
699
|
+
onTertiary: {
|
|
700
|
+
palette: () => palettes.get('tertiary'),
|
|
701
|
+
background: () => getColor('tertiary'),
|
|
702
|
+
contrastCurve: () => getCurve(6),
|
|
703
|
+
},
|
|
704
|
+
tertiaryContainer: {
|
|
705
|
+
palette: () => palettes.get('tertiary'),
|
|
706
|
+
tone: () => {
|
|
707
|
+
return tMaxC(palettes.get('tertiary'), 0, c.isDark ? 93 : 100);
|
|
708
|
+
},
|
|
709
|
+
isBackground: true,
|
|
710
|
+
background: () => highestSurface(c, colors),
|
|
711
|
+
adjustTone: () => undefined,
|
|
712
|
+
contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
713
|
+
},
|
|
714
|
+
onTertiaryContainer: {
|
|
715
|
+
palette: () => palettes.get('tertiary'),
|
|
716
|
+
background: () => getColor('tertiaryContainer'),
|
|
717
|
+
contrastCurve: () => getCurve(6),
|
|
718
|
+
},
|
|
719
|
+
|
|
720
|
+
// tertiaryFixed: {
|
|
721
|
+
// palette: () => palettes.get('tertiary'),
|
|
722
|
+
// tone: () => {
|
|
723
|
+
// return c.temp(
|
|
724
|
+
// {
|
|
725
|
+
// isDark: false,
|
|
726
|
+
// contrastLevel: 0,
|
|
727
|
+
// },
|
|
728
|
+
// () => {
|
|
729
|
+
// const color = getColor('tertiaryContainer');
|
|
730
|
+
// return color.getTone();
|
|
731
|
+
// },
|
|
732
|
+
// );
|
|
733
|
+
// },
|
|
734
|
+
// isBackground: true,
|
|
735
|
+
// background: () => highestSurface(c, colors),
|
|
736
|
+
// contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
737
|
+
// },
|
|
738
|
+
|
|
739
|
+
// tertiaryFixedDim: {
|
|
740
|
+
// palette: () => palettes.get('tertiary'),
|
|
741
|
+
// tone: () => getColor('tertiaryFixed').getTone(),
|
|
742
|
+
// isBackground: true,
|
|
743
|
+
// adjustTone: () =>
|
|
744
|
+
// toneDeltaPair(
|
|
745
|
+
// getColor('tertiaryFixedDim'),
|
|
746
|
+
// getColor('tertiaryFixed'),
|
|
747
|
+
// 5,
|
|
748
|
+
// 'darker',
|
|
749
|
+
// true,
|
|
750
|
+
// 'exact',
|
|
751
|
+
// ),
|
|
752
|
+
// },
|
|
753
|
+
|
|
754
|
+
// onTertiaryFixed: {
|
|
755
|
+
// palette: () => palettes.get('tertiary'),
|
|
756
|
+
// background: () => getColor('tertiaryFixedDim'),
|
|
757
|
+
// contrastCurve: () => getCurve(7),
|
|
758
|
+
// },
|
|
759
|
+
|
|
760
|
+
// onTertiaryFixedVariant: {
|
|
761
|
+
// palette: () => palettes.get('tertiary'),
|
|
762
|
+
// background: () => getColor('tertiaryFixedDim'),
|
|
763
|
+
// contrastCurve: () => getCurve(4.5),
|
|
764
|
+
// },
|
|
765
|
+
|
|
766
|
+
////////////////////////////////////////////////////////////////
|
|
767
|
+
// Errors [E] //
|
|
768
|
+
////////////////////////////////////////////////////////////////
|
|
769
|
+
|
|
770
|
+
error: {
|
|
771
|
+
palette: () => palettes.get('error'),
|
|
772
|
+
tone: () => {
|
|
773
|
+
return c.isDark
|
|
774
|
+
? tMinC(palettes.get('error'), 0, 98)
|
|
775
|
+
: tMaxC(palettes.get('error'));
|
|
776
|
+
},
|
|
777
|
+
isBackground: true,
|
|
778
|
+
background: () => highestSurface(c, colors),
|
|
779
|
+
contrastCurve: () => getCurve(4.5),
|
|
780
|
+
adjustTone: () =>
|
|
781
|
+
toneDeltaPair(
|
|
782
|
+
colors.get('errorContainer'),
|
|
783
|
+
colors.get('error'),
|
|
784
|
+
5,
|
|
785
|
+
'relative_lighter',
|
|
786
|
+
true,
|
|
787
|
+
'farther',
|
|
788
|
+
),
|
|
789
|
+
},
|
|
790
|
+
// errorDim: {
|
|
791
|
+
// palette: () => palettes.get('error'),
|
|
792
|
+
// tone: () => tMinC(palettes.get('error')),
|
|
793
|
+
// isBackground: true,
|
|
794
|
+
// background: () => getColor('surfaceContainerHigh'),
|
|
795
|
+
// contrastCurve: () => getCurve(4.5),
|
|
796
|
+
// adjustTone: () =>
|
|
797
|
+
// toneDeltaPair(
|
|
798
|
+
// getColor('errorDim'),
|
|
799
|
+
// getColor('error'),
|
|
800
|
+
// 5,
|
|
801
|
+
// 'darker',
|
|
802
|
+
// true,
|
|
803
|
+
// 'farther',
|
|
804
|
+
// ),
|
|
805
|
+
// },
|
|
806
|
+
onError: {
|
|
807
|
+
palette: () => palettes.get('error'),
|
|
808
|
+
background: () => colors.get('error'),
|
|
809
|
+
contrastCurve: () => getCurve(6),
|
|
810
|
+
},
|
|
811
|
+
errorContainer: {
|
|
812
|
+
palette: () => palettes.get('error'),
|
|
813
|
+
tone: () => {
|
|
814
|
+
return c.isDark
|
|
815
|
+
? tMinC(palettes.get('error'), 30, 93)
|
|
816
|
+
: tMaxC(palettes.get('error'), 0, 90);
|
|
817
|
+
},
|
|
818
|
+
isBackground: true,
|
|
819
|
+
background: () => highestSurface(c, colors),
|
|
820
|
+
adjustTone: () => undefined,
|
|
821
|
+
contrastCurve: () => (c.contrastLevel > 0 ? getCurve(1.5) : undefined),
|
|
822
|
+
},
|
|
823
|
+
onErrorContainer: {
|
|
824
|
+
palette: () => palettes.get('error'),
|
|
825
|
+
background: () => colors.get('errorContainer'),
|
|
826
|
+
contrastCurve: () => getCurve(4.5),
|
|
827
|
+
},
|
|
828
|
+
|
|
829
|
+
/////////////////////////////////////////////////////////////////
|
|
830
|
+
// Remapped Colors //
|
|
831
|
+
/////////////////////////////////////////////////////////////////
|
|
832
|
+
surfaceVariant: {
|
|
833
|
+
alias: 'surfaceContainerHighest',
|
|
834
|
+
},
|
|
835
|
+
surfaceTint: {
|
|
836
|
+
alias: 'primary',
|
|
837
|
+
},
|
|
838
|
+
background: {
|
|
839
|
+
alias: 'surface',
|
|
840
|
+
},
|
|
841
|
+
onBackground: {
|
|
842
|
+
alias: 'onSurface',
|
|
843
|
+
},
|
|
844
|
+
};
|
|
845
|
+
},
|
|
846
|
+
});
|