@skbkontur/colors 2.0.0-alpha.0 → 2.0.0-alpha.2

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.
Files changed (62) hide show
  1. package/dist/cjs/get-base-tokens.d.ts +7 -0
  2. package/dist/cjs/get-base-tokens.js +121 -1
  3. package/dist/cjs/get-colors.d.ts +2 -1
  4. package/dist/cjs/get-colors.js +6 -2
  5. package/dist/cjs/get-default-tokens.d.ts +12 -12
  6. package/dist/cjs/get-default-tokens.js +15 -16
  7. package/dist/cjs/helpers/get-palette.js +3 -3
  8. package/dist/colors.default-dark.js +326 -319
  9. package/dist/colors.default-light.js +329 -319
  10. package/dist/colors.js +319 -319
  11. package/dist/colors.less +319 -319
  12. package/dist/colors.scss +319 -319
  13. package/dist/esm/get-base-tokens.d.ts +7 -0
  14. package/dist/esm/get-base-tokens.js +110 -0
  15. package/dist/esm/get-colors.d.ts +2 -1
  16. package/dist/esm/get-colors.js +7 -3
  17. package/dist/esm/get-default-tokens.d.ts +12 -12
  18. package/dist/esm/get-default-tokens.js +15 -16
  19. package/dist/esm/helpers/get-palette.js +3 -3
  20. package/dist/tokens/brand-blue-deep_accent-brand.css +640 -640
  21. package/dist/tokens/brand-blue-deep_accent-gray.css +640 -640
  22. package/dist/tokens/brand-blue_accent-brand.css +640 -640
  23. package/dist/tokens/brand-blue_accent-gray.css +640 -640
  24. package/dist/tokens/brand-green_accent-brand.css +640 -640
  25. package/dist/tokens/brand-green_accent-gray.css +640 -640
  26. package/dist/tokens/brand-mint_accent-brand.css +640 -640
  27. package/dist/tokens/brand-mint_accent-gray.css +640 -640
  28. package/dist/tokens/brand-orange_accent-gray.css +640 -640
  29. package/dist/tokens/brand-purple_accent-brand.css +640 -640
  30. package/dist/tokens/brand-purple_accent-gray.css +640 -640
  31. package/dist/tokens/brand-red_accent-gray.css +640 -640
  32. package/dist/tokens/brand-violet_accent-brand.css +640 -640
  33. package/dist/tokens/brand-violet_accent-gray.css +640 -640
  34. package/dist/tokens-js/brand-blue-deep_accent-brand.js +15 -15
  35. package/dist/tokens-js/brand-blue-deep_accent-gray.js +15 -15
  36. package/dist/tokens-js/brand-blue_accent-brand.js +15 -15
  37. package/dist/tokens-js/brand-blue_accent-gray.js +15 -15
  38. package/dist/tokens-js/brand-green_accent-brand.js +15 -15
  39. package/dist/tokens-js/brand-green_accent-gray.js +15 -15
  40. package/dist/tokens-js/brand-mint_accent-brand.js +15 -15
  41. package/dist/tokens-js/brand-mint_accent-gray.js +15 -15
  42. package/dist/tokens-js/brand-orange_accent-gray.js +15 -15
  43. package/dist/tokens-js/brand-purple_accent-brand.js +15 -15
  44. package/dist/tokens-js/brand-purple_accent-gray.js +15 -15
  45. package/dist/tokens-js/brand-red_accent-gray.js +15 -15
  46. package/dist/tokens-js/brand-violet_accent-brand.js +15 -15
  47. package/dist/tokens-js/brand-violet_accent-gray.js +15 -15
  48. package/dist/tokens-mobile/brand-blue-deep_accent-brand.json +13 -13
  49. package/dist/tokens-mobile/brand-blue-deep_accent-gray.json +13 -13
  50. package/dist/tokens-mobile/brand-blue_accent-brand.json +13 -13
  51. package/dist/tokens-mobile/brand-blue_accent-gray.json +13 -13
  52. package/dist/tokens-mobile/brand-green_accent-brand.json +13 -13
  53. package/dist/tokens-mobile/brand-green_accent-gray.json +13 -13
  54. package/dist/tokens-mobile/brand-mint_accent-brand.json +13 -13
  55. package/dist/tokens-mobile/brand-mint_accent-gray.json +13 -13
  56. package/dist/tokens-mobile/brand-orange_accent-gray.json +13 -13
  57. package/dist/tokens-mobile/brand-purple_accent-brand.json +13 -13
  58. package/dist/tokens-mobile/brand-purple_accent-gray.json +13 -13
  59. package/dist/tokens-mobile/brand-red_accent-gray.json +13 -13
  60. package/dist/tokens-mobile/brand-violet_accent-brand.json +13 -13
  61. package/dist/tokens-mobile/brand-violet_accent-gray.json +13 -13
  62. package/package.json +2 -2
@@ -7,13 +7,20 @@ export interface ColorObject {
7
7
  }
8
8
  export type ColorValue = string | ColorObject | ColorValue[];
9
9
  type ColorStructure = ColorObject | ColorValue[];
10
+ export type ColorFormat = 'hex/rgba' | 'rgb/rgba' | 'oklch' | 'hex-aarrggbb';
10
11
  export interface ConfigOptions {
11
12
  brand: PresetOrCustom<keyof typeof DEFAULT_SWATCH.brand>;
12
13
  accent: PresetOrCustom<(typeof ACCENT_PARAMS)[number]>;
13
14
  system?: typeof DEFAULT_SWATCH.system;
15
+ format?: ColorFormat;
14
16
  }
15
17
  export declare function getBaseTokens({ brand, accent, system }: ConfigOptions): BaseTokens;
16
18
  export declare function convertOklchToHex(obj: ColorStructure): ColorStructure;
17
19
  export declare const convertOklchToRgba: (oklchString: string) => string;
18
20
  export declare function convertAlphaOklchToRgba(obj: ColorStructure): ColorStructure;
21
+ export declare const convertHexToRgbString: (hexString: string) => string;
22
+ export declare function convertHexValuesToRgb(obj: ColorStructure): ColorStructure;
23
+ export declare const convertToAarrggbb: (colorString: string) => string;
24
+ export declare function convertToAarrggbbRecursive(obj: ColorStructure): ColorStructure;
25
+ export declare function convertColorFormat(obj: ColorStructure, format?: ColorFormat): ColorStructure;
19
26
  export {};
@@ -133,6 +133,7 @@ export function convertAlphaOklchToRgba(obj) {
133
133
  for (var key in obj) {
134
134
  if (Object.prototype.hasOwnProperty.call(obj, key)) {
135
135
  var value = obj[key];
136
+ // Конвертируем OKLCH с альфа-каналом (содержит '/') в RGBA
136
137
  if (typeof value === 'string' && value.includes('oklch(')) {
137
138
  value = convertOklchToRgba(value);
138
139
  }
@@ -145,3 +146,112 @@ export function convertAlphaOklchToRgba(obj) {
145
146
  }
146
147
  return newObj;
147
148
  }
149
+ export var convertHexToRgbString = function (hexString) {
150
+ var _a;
151
+ var color = converter('rgb')(hexString);
152
+ if (!color) {
153
+ return hexString;
154
+ }
155
+ var r = Math.round(color.r * 255);
156
+ var g = Math.round(color.g * 255);
157
+ var b = Math.round(color.b * 255);
158
+ var alpha = (_a = color.alpha) !== null && _a !== void 0 ? _a : 1;
159
+ return alpha === 1
160
+ ? 'rgb('.concat(r, ', ').concat(g, ', ').concat(b, ')')
161
+ : 'rgba('.concat(r, ', ').concat(g, ', ').concat(b, ', ').concat(alpha, ')');
162
+ };
163
+ export function convertHexValuesToRgb(obj) {
164
+ if (typeof obj !== 'object' || obj === null) {
165
+ return obj;
166
+ }
167
+ if (Array.isArray(obj)) {
168
+ return obj.map(function (item) {
169
+ if (typeof item === 'object' && item !== null) {
170
+ return convertHexValuesToRgb(item);
171
+ }
172
+ return item;
173
+ });
174
+ }
175
+ var newObj = {};
176
+ for (var key in obj) {
177
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
178
+ var value = obj[key];
179
+ // Конвертируем HEX-строки в RGB(A)-строки
180
+ if (typeof value === 'string' && value.startsWith('#')) {
181
+ newObj[key] = convertHexToRgbString(value);
182
+ } else if (typeof value === 'object' && value !== null) {
183
+ newObj[key] = convertHexValuesToRgb(value);
184
+ } else {
185
+ newObj[key] = value;
186
+ }
187
+ }
188
+ }
189
+ return newObj;
190
+ }
191
+ export var convertToAarrggbb = function (colorString) {
192
+ var _a;
193
+ var color = converter('rgb')(colorString);
194
+ if (!color) {
195
+ return colorString;
196
+ }
197
+ var r = Math.round(color.r * 255);
198
+ var g = Math.round(color.g * 255);
199
+ var b = Math.round(color.b * 255);
200
+ var alpha = Math.round(((_a = color.alpha) !== null && _a !== void 0 ? _a : 1) * 255);
201
+ var toHex = function (c) {
202
+ return c.toString(16).padStart(2, '0');
203
+ };
204
+ var rgbHex = ''.concat(toHex(r)).concat(toHex(g)).concat(toHex(b)).toUpperCase();
205
+ if (alpha === 255) {
206
+ return '#'.concat(rgbHex);
207
+ }
208
+ return '#'.concat(toHex(alpha)).concat(rgbHex).toUpperCase();
209
+ };
210
+ export function convertToAarrggbbRecursive(obj) {
211
+ if (typeof obj !== 'object' || obj === null) {
212
+ return obj;
213
+ }
214
+ if (Array.isArray(obj)) {
215
+ return obj.map(function (item) {
216
+ if (typeof item === 'object' && item !== null) {
217
+ return convertToAarrggbbRecursive(item);
218
+ }
219
+ return item;
220
+ });
221
+ }
222
+ var newObj = {};
223
+ for (var key in obj) {
224
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
225
+ var value = obj[key];
226
+ // Конвертируем строки цветов (HEX, RGBA) в AARRGGBB
227
+ if (typeof value === 'string') {
228
+ newObj[key] = convertToAarrggbb(value); // Измененная логика в этой функции
229
+ } else if (typeof value === 'object' && value !== null) {
230
+ newObj[key] = convertToAarrggbbRecursive(value);
231
+ } else {
232
+ newObj[key] = value;
233
+ }
234
+ }
235
+ }
236
+ return newObj;
237
+ }
238
+ export function convertColorFormat(obj, format) {
239
+ if (format === void 0) {
240
+ format = 'hex/rgba';
241
+ }
242
+ var result = obj;
243
+ result = convertOklchToHex(obj);
244
+ result = convertAlphaOklchToRgba(result);
245
+ switch (format) {
246
+ case 'oklch':
247
+ return obj;
248
+ case 'hex/rgba':
249
+ return result;
250
+ case 'rgb/rgba':
251
+ return convertHexValuesToRgb(result);
252
+ case 'hex-aarrggbb':
253
+ return convertToAarrggbbRecursive(result);
254
+ default:
255
+ return result;
256
+ }
257
+ }
@@ -1,4 +1,4 @@
1
- import { type ConfigOptions } from './get-base-tokens';
1
+ import { type ConfigOptions, type ColorFormat } from './get-base-tokens';
2
2
  import { getDefaultTokens } from './get-default-tokens';
3
3
  import type { BaseTokens } from './types/base-tokens';
4
4
  export interface Themed<T> {
@@ -10,6 +10,7 @@ export type DefaultTokens = DefaultTokensFull['light' | 'dark'];
10
10
  export interface SemanticConfigOptions<T> extends ConfigOptions {
11
11
  theme?: 'light' | 'dark';
12
12
  overrides?: (base: BaseTokens, defaults?: DefaultTokensFull, params?: SemanticConfigOptions<T>) => Themed<T>;
13
+ format?: ColorFormat;
13
14
  }
14
15
  export declare function getColors(params: SemanticConfigOptions<DefaultTokens>): DefaultTokens;
15
16
  export declare function getColors<T>(
@@ -1,12 +1,16 @@
1
- import { getBaseTokens } from './get-base-tokens';
1
+ import { getBaseTokens, convertColorFormat } from './get-base-tokens';
2
2
  import { getDefaultTokens } from './get-default-tokens';
3
3
  var DEFAULT_THEME = 'light';
4
4
  export function getColors(params) {
5
5
  var theme = params.theme || DEFAULT_THEME;
6
6
  var base = getBaseTokens(params);
7
7
  var defaults = getDefaultTokens(base);
8
+ var result;
8
9
  if (params.overrides) {
9
- return params.overrides(base, defaults, params)[theme];
10
+ result = params.overrides(base, defaults, params)[theme];
11
+ } else {
12
+ result = defaults[theme];
10
13
  }
11
- return defaults[theme];
14
+ var finalResult = convertColorFormat(result, params.format);
15
+ return finalResult;
12
16
  }
@@ -4,17 +4,16 @@ export declare const getDefaultTokens: (base: BaseTokens) => {
4
4
  textAccentHeavy: string;
5
5
  textAccentHeavyHover: string;
6
6
  textAccentHeavyPressed: string;
7
- textDisabled: string;
8
7
  textErrorHeavy: string;
9
8
  textErrorHeavyHover: string;
10
9
  textErrorHeavyPressed: string;
11
10
  textInvertedAccentHeavy: string;
12
11
  textInvertedAccentHeavyHover: string;
13
12
  textInvertedAccentHeavyPressed: string;
14
- textInvertedDisabled: string;
15
13
  textInvertedErrorHeavy: string;
16
14
  textInvertedErrorHeavyHover: string;
17
15
  textInvertedErrorHeavyPressed: string;
16
+ textInvertedNeutralFaint: string;
18
17
  textInvertedNeutralHeavy: string;
19
18
  textInvertedNeutralPale: string;
20
19
  textInvertedNeutralSoft: string;
@@ -25,6 +24,7 @@ export declare const getDefaultTokens: (base: BaseTokens) => {
25
24
  textInvertedWarningHeavyHover: string;
26
25
  textInvertedWarningHeavyPressed: string;
27
26
  textLogo: string;
27
+ textNeutralFaint: string;
28
28
  textNeutralHeavy: string;
29
29
  textNeutralPale: string;
30
30
  textNeutralSoft: string;
@@ -34,19 +34,19 @@ export declare const getDefaultTokens: (base: BaseTokens) => {
34
34
  textWarningHeavy: string;
35
35
  textWarningHeavyHover: string;
36
36
  textWarningHeavyPressed: string;
37
- textConstDisabledBlack: string;
38
- textConstDisabledWhite: string;
37
+ textConstFaintBlack: string;
38
+ textConstFaintWhite: string;
39
39
  textConstHeavyBlack: string;
40
40
  textConstHeavyWhite: string;
41
41
  textConstPaleBlack: string;
42
42
  textConstPaleWhite: string;
43
43
  textConstSoftBlack: string;
44
44
  textConstSoftWhite: string;
45
- textOnAccentBoldDisabled: string;
45
+ textOnAccentBoldFaint: string;
46
46
  textOnAccentBoldHeavy: string;
47
47
  textOnAccentBoldPale: string;
48
48
  textOnAccentBoldSoft: string;
49
- textOnBrandOriginalDisabled: string;
49
+ textOnBrandOriginalFaint: string;
50
50
  textOnBrandOriginalHeavy: string;
51
51
  textOnBrandOriginalPale: string;
52
52
  textOnBrandOriginalSoft: string;
@@ -325,17 +325,16 @@ export declare const getDefaultTokens: (base: BaseTokens) => {
325
325
  textAccentHeavy: string;
326
326
  textAccentHeavyHover: string;
327
327
  textAccentHeavyPressed: string;
328
- textDisabled: string;
329
328
  textErrorHeavy: string;
330
329
  textErrorHeavyHover: string;
331
330
  textErrorHeavyPressed: string;
332
331
  textInvertedAccentHeavy: string;
333
332
  textInvertedAccentHeavyHover: string;
334
333
  textInvertedAccentHeavyPressed: string;
335
- textInvertedDisabled: string;
336
334
  textInvertedErrorHeavy: string;
337
335
  textInvertedErrorHeavyHover: string;
338
336
  textInvertedErrorHeavyPressed: string;
337
+ textInvertedNeutralFaint: string;
339
338
  textInvertedNeutralHeavy: string;
340
339
  textInvertedNeutralPale: string;
341
340
  textInvertedNeutralSoft: string;
@@ -346,6 +345,7 @@ export declare const getDefaultTokens: (base: BaseTokens) => {
346
345
  textInvertedWarningHeavyHover: string;
347
346
  textInvertedWarningHeavyPressed: string;
348
347
  textLogo: string;
348
+ textNeutralFaint: string;
349
349
  textNeutralHeavy: string;
350
350
  textNeutralPale: string;
351
351
  textNeutralSoft: string;
@@ -355,19 +355,19 @@ export declare const getDefaultTokens: (base: BaseTokens) => {
355
355
  textWarningHeavy: string;
356
356
  textWarningHeavyHover: string;
357
357
  textWarningHeavyPressed: string;
358
- textConstDisabledBlack: string;
359
- textConstDisabledWhite: string;
358
+ textConstFaintBlack: string;
359
+ textConstFaintWhite: string;
360
360
  textConstHeavyBlack: string;
361
361
  textConstHeavyWhite: string;
362
362
  textConstPaleBlack: string;
363
363
  textConstPaleWhite: string;
364
364
  textConstSoftBlack: string;
365
365
  textConstSoftWhite: string;
366
- textOnAccentBoldDisabled: string;
366
+ textOnAccentBoldFaint: string;
367
367
  textOnAccentBoldHeavy: string;
368
368
  textOnAccentBoldPale: string;
369
369
  textOnAccentBoldSoft: string;
370
- textOnBrandOriginalDisabled: string;
370
+ textOnBrandOriginalFaint: string;
371
371
  textOnBrandOriginalHeavy: string;
372
372
  textOnBrandOriginalPale: string;
373
373
  textOnBrandOriginalSoft: string;
@@ -171,7 +171,6 @@ export var getDefaultTokens = function (base) {
171
171
  ((_f = (_e = base.accent) === null || _e === void 0 ? void 0 : _e.palette) === null || _f === void 0
172
172
  ? void 0
173
173
  : _f.dim[48]) || base.blackAlpha[96],
174
- textDisabled: base.blackAlpha[32],
175
174
  textErrorHeavy: base.customizable.red.vivid[52],
176
175
  textErrorHeavyHover: base.customizable.red.vivid[60],
177
176
  textErrorHeavyPressed: base.customizable.red.dim[48],
@@ -187,10 +186,10 @@ export var getDefaultTokens = function (base) {
187
186
  ((_m = (_l = base.accent) === null || _l === void 0 ? void 0 : _l.palette) === null || _m === void 0
188
187
  ? void 0
189
188
  : _m.dim[64]) || base.gray[100],
190
- textInvertedDisabled: base.whiteAlpha[40],
191
189
  textInvertedErrorHeavy: base.customizable.red.vivid[68],
192
190
  textInvertedErrorHeavyHover: base.customizable.red.vivid[72],
193
191
  textInvertedErrorHeavyPressed: base.customizable.red.dim[64],
192
+ textInvertedNeutralFaint: base.whiteAlpha[40],
194
193
  textInvertedNeutralHeavy: base.whiteAlpha[96],
195
194
  textInvertedNeutralPale: base.whiteAlpha[48],
196
195
  textInvertedNeutralSoft: base.whiteAlpha[64],
@@ -201,6 +200,7 @@ export var getDefaultTokens = function (base) {
201
200
  textInvertedWarningHeavyHover: base.warning.vivid[84],
202
201
  textInvertedWarningHeavyPressed: base.warning.dim[72],
203
202
  textLogo: base.brand.logo.light,
203
+ textNeutralFaint: base.blackAlpha[32],
204
204
  textNeutralHeavy: base.blackAlpha[88],
205
205
  textNeutralPale: base.blackAlpha[40],
206
206
  textNeutralSoft: base.blackAlpha[56],
@@ -210,20 +210,19 @@ export var getDefaultTokens = function (base) {
210
210
  textWarningHeavy: base.warning.vivid[64],
211
211
  textWarningHeavyHover: base.warning.vivid[72],
212
212
  textWarningHeavyPressed: base.warning.dim[60],
213
- textConstDisabledBlack: base.blackAlpha[32],
214
- textConstDisabledWhite: base.whiteAlpha[40],
213
+ textConstFaintBlack: base.blackAlpha[32],
214
+ textConstFaintWhite: base.whiteAlpha[40],
215
215
  textConstHeavyBlack: base.blackAlpha[88],
216
216
  textConstHeavyWhite: base.whiteAlpha[96],
217
217
  textConstPaleBlack: base.blackAlpha[40],
218
218
  textConstPaleWhite: base.whiteAlpha[48],
219
219
  textConstSoftBlack: base.blackAlpha[56],
220
220
  textConstSoftWhite: base.whiteAlpha[64],
221
- textOnAccentBoldDisabled:
222
- ((_o = base.onAccent) === null || _o === void 0 ? void 0 : _o[40]) || base.whiteAlpha[40],
221
+ textOnAccentBoldFaint: ((_o = base.onAccent) === null || _o === void 0 ? void 0 : _o[40]) || base.whiteAlpha[40],
223
222
  textOnAccentBoldHeavy: ((_p = base.onAccent) === null || _p === void 0 ? void 0 : _p[96]) || base.whiteAlpha[96],
224
223
  textOnAccentBoldPale: ((_q = base.onAccent) === null || _q === void 0 ? void 0 : _q[48]) || base.whiteAlpha[48],
225
224
  textOnAccentBoldSoft: ((_r = base.onAccent) === null || _r === void 0 ? void 0 : _r[64]) || base.whiteAlpha[64],
226
- textOnBrandOriginalDisabled: base.onBrand[40],
225
+ textOnBrandOriginalFaint: base.onBrand[40],
227
226
  textOnBrandOriginalHeavy: base.onBrand[96],
228
227
  textOnBrandOriginalPale: base.onBrand[48],
229
228
  textOnBrandOriginalSoft: base.onBrand[64],
@@ -585,7 +584,6 @@ export var getDefaultTokens = function (base) {
585
584
  ((_60 = (_59 = base.accent) === null || _59 === void 0 ? void 0 : _59.palette) === null || _60 === void 0
586
585
  ? void 0
587
586
  : _60.dim[64]) || base.gray[100],
588
- textDisabled: base.whiteAlpha[40],
589
587
  textErrorHeavy: base.customizable.red.vivid[68],
590
588
  textErrorHeavyHover: base.customizable.red.vivid[72],
591
589
  textErrorHeavyPressed: base.customizable.red.dim[64],
@@ -601,10 +599,10 @@ export var getDefaultTokens = function (base) {
601
599
  ((_66 = (_65 = base.accent) === null || _65 === void 0 ? void 0 : _65.palette) === null || _66 === void 0
602
600
  ? void 0
603
601
  : _66.dim[48]) || base.blackAlpha[96],
604
- textInvertedDisabled: base.blackAlpha[32],
605
602
  textInvertedErrorHeavy: base.customizable.red.vivid[52],
606
603
  textInvertedErrorHeavyHover: base.customizable.red.vivid[60],
607
604
  textInvertedErrorHeavyPressed: base.customizable.red.dim[48],
605
+ textInvertedNeutralFaint: base.blackAlpha[32],
608
606
  textInvertedNeutralHeavy: base.blackAlpha[88],
609
607
  textInvertedNeutralPale: base.blackAlpha[40],
610
608
  textInvertedNeutralSoft: base.blackAlpha[56],
@@ -615,6 +613,7 @@ export var getDefaultTokens = function (base) {
615
613
  textInvertedWarningHeavyHover: base.warning.vivid[72],
616
614
  textInvertedWarningHeavyPressed: base.warning.dim[56],
617
615
  textLogo: base.brand.logo.dark,
616
+ textNeutralFaint: base.whiteAlpha[40],
618
617
  textNeutralHeavy: base.whiteAlpha[96],
619
618
  textNeutralPale: base.whiteAlpha[48],
620
619
  textNeutralSoft: base.whiteAlpha[64],
@@ -624,15 +623,15 @@ export var getDefaultTokens = function (base) {
624
623
  textWarningHeavy: base.warning.vivid[80],
625
624
  textWarningHeavyHover: base.warning.vivid[84],
626
625
  textWarningHeavyPressed: base.warning.dim[72],
627
- textConstDisabledBlack: base.blackAlpha[32],
628
- textConstDisabledWhite: base.whiteAlpha[40],
626
+ textConstFaintBlack: base.blackAlpha[32],
627
+ textConstFaintWhite: base.whiteAlpha[40],
629
628
  textConstHeavyBlack: base.blackAlpha[88],
630
629
  textConstHeavyWhite: base.whiteAlpha[96],
631
630
  textConstPaleBlack: base.blackAlpha[40],
632
631
  textConstPaleWhite: base.whiteAlpha[48],
633
632
  textConstSoftBlack: base.blackAlpha[56],
634
633
  textConstSoftWhite: base.whiteAlpha[64],
635
- textOnAccentBoldDisabled:
634
+ textOnAccentBoldFaint:
636
635
  ((_67 = base.onAccent) === null || _67 === void 0 ? void 0 : _67[32]) || base.blackAlpha[32],
637
636
  textOnAccentBoldHeavy:
638
637
  ((_68 = base.onAccent) === null || _68 === void 0 ? void 0 : _68[96]) || base.blackAlpha[88],
@@ -640,7 +639,7 @@ export var getDefaultTokens = function (base) {
640
639
  ((_69 = base.onAccent) === null || _69 === void 0 ? void 0 : _69[40]) || base.blackAlpha[40],
641
640
  textOnAccentBoldSoft:
642
641
  ((_70 = base.onAccent) === null || _70 === void 0 ? void 0 : _70[56]) || base.blackAlpha[56],
643
- textOnBrandOriginalDisabled: base.onBrand[40],
642
+ textOnBrandOriginalFaint: base.onBrand[40],
644
643
  textOnBrandOriginalHeavy: base.onBrand[96],
645
644
  textOnBrandOriginalPale: base.onBrand[48],
646
645
  textOnBrandOriginalSoft: base.onBrand[64],
@@ -698,9 +697,9 @@ export var getDefaultTokens = function (base) {
698
697
  shapeOtherAccentBoldDisabled: base.whiteAlpha[32],
699
698
  shapeOtherBacklessHover: base.whiteAlpha[6],
700
699
  shapeOtherBacklessPressed: base.whiteAlpha[4],
701
- shapeOtherBase: base.gray[32],
702
- shapeOtherBaseHover: base.gray[36],
703
- shapeOtherBasePressed: base.gray[28],
700
+ shapeOtherBase: base.whiteAlpha[6],
701
+ shapeOtherBaseHover: base.whiteAlpha[8],
702
+ shapeOtherBasePressed: base.whiteAlpha[4],
704
703
  shapeOtherDisabled: base.whiteAlpha[6],
705
704
  shapeOtherField: base.blackAlpha[16],
706
705
  shapeOtherFieldHover: base.blackAlpha[4],
@@ -223,9 +223,9 @@ export function calculateBaseHueAndCorrectionRange(inputColorString, abneyData)
223
223
  };
224
224
  }
225
225
  export function calcOnBrand(hex) {
226
- var whiteContrast = Number(calcAPCA('#fff', hex));
227
- var blackContrast = Number(calcAPCA('#000', hex));
228
- if (whiteContrast - 10 <= blackContrast) {
226
+ var whiteContrast = Math.abs(Number(calcAPCA('#fff', hex)));
227
+ var blackContrast = Math.abs(Number(calcAPCA('#000', hex)));
228
+ if (whiteContrast + 10 >= blackContrast) {
229
229
  return DefaultSwatch.whiteAlpha;
230
230
  }
231
231
  return DefaultSwatch.blackAlpha;