@skbkontur/colors 2.0.0-alpha.2 → 2.0.0-alpha.3
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 +84 -0
- package/README.md +104 -171
- package/dist/colors.default-dark.js +16 -16
- package/dist/colors.default-light.js +17 -17
- package/dist/esm/consts/params/abney-correction.d.ts +2 -0
- package/dist/esm/consts/params/chroma-params.d.ts +2 -0
- package/dist/esm/{constants/chroma-settings.js → consts/params/chroma-params.js} +1 -1
- package/dist/esm/consts/params/logo-lightness.d.ts +1 -0
- package/dist/esm/consts/params/logo-lightness.js +1 -0
- package/dist/esm/get-colors-base.d.ts +12 -0
- package/dist/esm/get-colors-base.js +81 -0
- package/dist/{cjs/get-default-tokens.d.ts → esm/get-colors-default-tokens.d.ts} +2 -2
- package/dist/{cjs/get-default-tokens.js → esm/get-colors-default-tokens.js} +34 -38
- package/dist/esm/get-colors.d.ts +3 -10
- package/dist/esm/get-colors.js +6 -8
- package/dist/esm/get-default-tokens.d.ts +1 -1
- package/dist/esm/get-default-tokens.js +33 -33
- package/dist/esm/helpers/get-interactions.js +1 -1
- package/dist/esm/helpers/get-logo.js +4 -4
- package/dist/esm/helpers/get-palette.d.ts +3 -3
- package/dist/esm/helpers/get-palette.js +6 -6
- package/dist/esm/helpers/get-promo.js +1 -1
- package/dist/esm/types/{generator-tokens.d.ts → tokens-base-generator.d.ts} +2 -2
- package/dist/esm/types/tokens.d.ts +12 -0
- package/dist/esm/types/tokens.js +1 -0
- package/dist/esm/utils/convert-color.d.ts +3 -0
- package/dist/esm/utils/convert-color.js +133 -0
- package/dist/tokens/brand-blue-deep_accent-brand.css +33 -33
- package/dist/tokens/brand-blue-deep_accent-gray.css +33 -33
- package/dist/tokens/brand-blue_accent-brand.css +33 -33
- package/dist/tokens/brand-blue_accent-gray.css +33 -33
- package/dist/tokens/brand-green_accent-brand.css +33 -33
- package/dist/tokens/brand-green_accent-gray.css +33 -33
- package/dist/tokens/brand-mint_accent-brand.css +33 -33
- package/dist/tokens/brand-mint_accent-gray.css +33 -33
- package/dist/tokens/brand-orange_accent-gray.css +33 -33
- package/dist/tokens/brand-purple_accent-brand.css +33 -33
- package/dist/tokens/brand-purple_accent-gray.css +33 -33
- package/dist/tokens/brand-red_accent-gray.css +33 -33
- package/dist/tokens/brand-violet_accent-brand.css +33 -33
- package/dist/tokens/brand-violet_accent-gray.css +33 -33
- package/dist/tokens-js/brand-blue-deep_accent-brand.js +33 -33
- package/dist/tokens-js/brand-blue-deep_accent-gray.js +33 -33
- package/dist/tokens-js/brand-blue_accent-brand.js +33 -33
- package/dist/tokens-js/brand-blue_accent-gray.js +33 -33
- package/dist/tokens-js/brand-green_accent-brand.js +33 -33
- package/dist/tokens-js/brand-green_accent-gray.js +33 -33
- package/dist/tokens-js/brand-mint_accent-brand.js +33 -33
- package/dist/tokens-js/brand-mint_accent-gray.js +33 -33
- package/dist/tokens-js/brand-orange_accent-gray.js +33 -33
- package/dist/tokens-js/brand-purple_accent-brand.js +33 -33
- package/dist/tokens-js/brand-purple_accent-gray.js +33 -33
- package/dist/tokens-js/brand-red_accent-gray.js +33 -33
- package/dist/tokens-js/brand-violet_accent-brand.js +33 -33
- package/dist/tokens-js/brand-violet_accent-gray.js +33 -33
- package/dist/tokens-mobile/brand-blue-deep_accent-brand.json +304 -304
- package/dist/tokens-mobile/brand-blue-deep_accent-gray.json +304 -304
- package/dist/tokens-mobile/brand-blue_accent-brand.json +304 -304
- package/dist/tokens-mobile/brand-blue_accent-gray.json +304 -304
- package/dist/tokens-mobile/brand-green_accent-brand.json +304 -304
- package/dist/tokens-mobile/brand-green_accent-gray.json +304 -304
- package/dist/tokens-mobile/brand-mint_accent-brand.json +304 -304
- package/dist/tokens-mobile/brand-mint_accent-gray.json +304 -304
- package/dist/tokens-mobile/brand-orange_accent-gray.json +303 -303
- package/dist/tokens-mobile/brand-purple_accent-brand.json +304 -304
- package/dist/tokens-mobile/brand-purple_accent-gray.json +304 -304
- package/dist/tokens-mobile/brand-red_accent-gray.json +303 -303
- package/dist/tokens-mobile/brand-violet_accent-brand.json +300 -300
- package/dist/tokens-mobile/brand-violet_accent-gray.json +302 -302
- package/package.json +13 -22
- package/scripts/babel-register.js +4 -0
- package/scripts/tokens-base.json +3499 -0
- package/scripts/tokens.json +710 -0
- package/dist/cjs/constants/abney-correction.d.ts +0 -2
- package/dist/cjs/constants/abney-correction.js +0 -1105
- package/dist/cjs/constants/chroma-settings.d.ts +0 -2
- package/dist/cjs/constants/chroma-settings.js +0 -105
- package/dist/cjs/constants/default-swatch.js +0 -112
- package/dist/cjs/constants/interaction-settings.js +0 -19
- package/dist/cjs/constants/logo-lightness.d.ts +0 -1
- package/dist/cjs/constants/logo-lightness.js +0 -4
- package/dist/cjs/constants/promo-hue-shift.js +0 -14
- package/dist/cjs/constants/warning-hue-patch.js +0 -25
- package/dist/cjs/get-base-tokens.d.ts +0 -26
- package/dist/cjs/get-base-tokens.js +0 -319
- package/dist/cjs/get-colors.d.ts +0 -20
- package/dist/cjs/get-colors.js +0 -20
- package/dist/cjs/helpers/get-interactions.d.ts +0 -7
- package/dist/cjs/helpers/get-interactions.js +0 -61
- package/dist/cjs/helpers/get-logo.d.ts +0 -6
- package/dist/cjs/helpers/get-logo.js +0 -32
- package/dist/cjs/helpers/get-palette.d.ts +0 -76
- package/dist/cjs/helpers/get-palette.js +0 -287
- package/dist/cjs/helpers/get-promo.d.ts +0 -12
- package/dist/cjs/helpers/get-promo.js +0 -56
- package/dist/cjs/types/base-tokens.js +0 -2
- package/dist/cjs/types/generator-tokens.d.ts +0 -43
- package/dist/cjs/types/generator-tokens.js +0 -2
- package/dist/cjs/utils/format-variable.d.ts +0 -2
- package/dist/cjs/utils/format-variable.js +0 -15
- package/dist/esm/constants/abney-correction.d.ts +0 -2
- package/dist/esm/constants/chroma-settings.d.ts +0 -2
- package/dist/esm/constants/default-swatch.d.ts +0 -109
- package/dist/esm/constants/interaction-settings.d.ts +0 -8
- package/dist/esm/constants/logo-lightness.d.ts +0 -1
- package/dist/esm/constants/logo-lightness.js +0 -1
- package/dist/esm/constants/promo-hue-shift.d.ts +0 -3
- package/dist/esm/constants/warning-hue-patch.d.ts +0 -3
- package/dist/esm/get-base-tokens.d.ts +0 -26
- package/dist/esm/get-base-tokens.js +0 -257
- package/dist/esm/types/base-tokens.d.ts +0 -125
- /package/dist/{cjs/constants → esm/consts}/default-swatch.d.ts +0 -0
- /package/dist/esm/{constants → consts}/default-swatch.js +0 -0
- /package/dist/esm/{constants → consts/params}/abney-correction.js +0 -0
- /package/dist/{cjs/constants/interaction-settings.d.ts → esm/consts/params/interactions.d.ts} +0 -0
- /package/dist/esm/{constants/interaction-settings.js → consts/params/interactions.js} +0 -0
- /package/dist/{cjs/constants → esm/consts/params}/promo-hue-shift.d.ts +0 -0
- /package/dist/esm/{constants → consts/params}/promo-hue-shift.js +0 -0
- /package/dist/{cjs/constants → esm/consts/params}/warning-hue-patch.d.ts +0 -0
- /package/dist/esm/{constants → consts/params}/warning-hue-patch.js +0 -0
- /package/dist/esm/types/{base-tokens.js → tokens-base-generator.js} +0 -0
- /package/dist/{cjs/types/base-tokens.d.ts → esm/types/tokens-base.d.ts} +0 -0
- /package/dist/esm/types/{generator-tokens.js → tokens-base.js} +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { calcOnBrand, getPalette } from './helpers/get-palette.js';
|
|
2
|
+
import { getHover, getPressed } from './helpers/get-interactions.js';
|
|
3
|
+
import { getLogo } from './helpers/get-logo.js';
|
|
4
|
+
import { getPromo } from './helpers/get-promo.js';
|
|
5
|
+
import { convertColorFormat } from './utils/convert-color.js';
|
|
6
|
+
import * as DEFAULT_SWATCH from './consts/default-swatch.js';
|
|
7
|
+
export function getColorsBase(_a) {
|
|
8
|
+
var brand = _a.brand,
|
|
9
|
+
_b = _a.accent,
|
|
10
|
+
accent = _b === void 0 ? 'gray' : _b,
|
|
11
|
+
_c = _a.system,
|
|
12
|
+
system = _c === void 0 ? DEFAULT_SWATCH.system : _c,
|
|
13
|
+
_d = _a.format,
|
|
14
|
+
format = _d === void 0 ? 'hex/rgba' : _d;
|
|
15
|
+
var isPresetColor = brand in DEFAULT_SWATCH.brand;
|
|
16
|
+
var brandColor;
|
|
17
|
+
if (isPresetColor) {
|
|
18
|
+
brandColor = DEFAULT_SWATCH.brand[brand];
|
|
19
|
+
} else {
|
|
20
|
+
brandColor = brand;
|
|
21
|
+
}
|
|
22
|
+
var accentColor;
|
|
23
|
+
if (accent === 'brand') {
|
|
24
|
+
accentColor = brandColor;
|
|
25
|
+
} else if (accent !== 'gray') {
|
|
26
|
+
accentColor = accent;
|
|
27
|
+
}
|
|
28
|
+
var brandPalette = getPalette({ color: brandColor });
|
|
29
|
+
var accentPalette;
|
|
30
|
+
if (accent === 'brand') {
|
|
31
|
+
accentPalette = brandPalette;
|
|
32
|
+
} else if (accent !== 'gray' && accentColor) {
|
|
33
|
+
accentPalette = getPalette({ color: accentColor });
|
|
34
|
+
}
|
|
35
|
+
var customizablePalettes = {};
|
|
36
|
+
for (var colorKey in DEFAULT_SWATCH.customizable) {
|
|
37
|
+
var key = colorKey;
|
|
38
|
+
if (key === brand && isPresetColor) {
|
|
39
|
+
customizablePalettes[key] = brandPalette;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
customizablePalettes[key] = getPalette({
|
|
43
|
+
color: DEFAULT_SWATCH.customizable[key],
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
var result = {
|
|
47
|
+
brand: {
|
|
48
|
+
logo: getLogo(brandColor),
|
|
49
|
+
promo: getPromo(brandColor),
|
|
50
|
+
original: brandColor,
|
|
51
|
+
interactions: {
|
|
52
|
+
hover: getHover(brandColor),
|
|
53
|
+
pressed: getPressed(brandColor),
|
|
54
|
+
},
|
|
55
|
+
palette: brandPalette,
|
|
56
|
+
},
|
|
57
|
+
accent: accentColor
|
|
58
|
+
? {
|
|
59
|
+
original: {
|
|
60
|
+
light: accentColor,
|
|
61
|
+
dark: accentColor,
|
|
62
|
+
},
|
|
63
|
+
interactions: {
|
|
64
|
+
hover: getHover(accentColor),
|
|
65
|
+
pressed: getPressed(accentColor),
|
|
66
|
+
},
|
|
67
|
+
palette: accentPalette,
|
|
68
|
+
}
|
|
69
|
+
: undefined,
|
|
70
|
+
warning: getPalette({ color: system.warning }),
|
|
71
|
+
error: getPalette({ color: system.error }),
|
|
72
|
+
success: getPalette({ color: system.success }),
|
|
73
|
+
gray: DEFAULT_SWATCH.gray,
|
|
74
|
+
whiteAlpha: DEFAULT_SWATCH.whiteAlpha,
|
|
75
|
+
blackAlpha: DEFAULT_SWATCH.blackAlpha,
|
|
76
|
+
onBrand: calcOnBrand(brandColor),
|
|
77
|
+
onAccent: accentColor ? calcOnBrand(accentColor) : undefined,
|
|
78
|
+
customizable: customizablePalettes,
|
|
79
|
+
};
|
|
80
|
+
return convertColorFormat(result, format);
|
|
81
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BaseTokens } from './types/base
|
|
2
|
-
export declare const
|
|
1
|
+
import type { BaseTokens } from './types/tokens-base.js';
|
|
2
|
+
export declare const getColorsDefaultTokens: (base: BaseTokens) => {
|
|
3
3
|
light: {
|
|
4
4
|
textAccentHeavy: string;
|
|
5
5
|
textAccentHeavyHover: string;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.getDefaultTokens = void 0;
|
|
4
|
-
var getDefaultTokens = function (base) {
|
|
1
|
+
export var getColorsDefaultTokens = function (base) {
|
|
5
2
|
var _a,
|
|
6
3
|
_b,
|
|
7
4
|
_c,
|
|
@@ -268,8 +265,8 @@ var getDefaultTokens = function (base) {
|
|
|
268
265
|
shapeFaintErrorHover: base.customizable.red.normal[92],
|
|
269
266
|
shapeFaintErrorPressed: base.customizable.red.dim[92],
|
|
270
267
|
shapeFaintNeutralAlpha: base.blackAlpha[6],
|
|
271
|
-
shapeFaintNeutralAlphaHover: base.blackAlpha[
|
|
272
|
-
shapeFaintNeutralAlphaPressed: base.blackAlpha[
|
|
268
|
+
shapeFaintNeutralAlphaHover: base.blackAlpha[12],
|
|
269
|
+
shapeFaintNeutralAlphaPressed: base.blackAlpha[16],
|
|
273
270
|
shapeFaintSuccess: base.customizable.green.normal[96],
|
|
274
271
|
shapeFaintSuccessHover: base.customizable.green.normal[92],
|
|
275
272
|
shapeFaintSuccessPressed: base.customizable.green.dim[92],
|
|
@@ -282,7 +279,7 @@ var getDefaultTokens = function (base) {
|
|
|
282
279
|
shapeHeavyWarning: base.warning.vivid[36],
|
|
283
280
|
shapeOtherAccentBoldDisabled: base.blackAlpha[32],
|
|
284
281
|
shapeOtherBacklessHover: base.blackAlpha[6],
|
|
285
|
-
shapeOtherBacklessPressed: base.blackAlpha[
|
|
282
|
+
shapeOtherBacklessPressed: base.blackAlpha[16],
|
|
286
283
|
shapeOtherBase: base.gray[100],
|
|
287
284
|
shapeOtherBaseHover: base.gray[96],
|
|
288
285
|
shapeOtherBasePressed: base.gray[92],
|
|
@@ -299,7 +296,7 @@ var getDefaultTokens = function (base) {
|
|
|
299
296
|
shapeOtherNeutralPaleSolid: base.gray[92],
|
|
300
297
|
shapeOtherNeutralPaleSolidHover: base.gray[88],
|
|
301
298
|
shapeOtherNeutralPaleSolidPressed: base.gray[84],
|
|
302
|
-
shapeOtherNeutralSoftSolid: base.gray[
|
|
299
|
+
shapeOtherNeutralSoftSolid: base.gray[88],
|
|
303
300
|
shapeOtherNeutralSoftSolidHover: base.gray[80],
|
|
304
301
|
shapeOtherNeutralSoftSolidPressed: base.gray[76],
|
|
305
302
|
shapePaleAccent:
|
|
@@ -320,9 +317,9 @@ var getDefaultTokens = function (base) {
|
|
|
320
317
|
shapePaleError: base.customizable.red.vivid[92],
|
|
321
318
|
shapePaleErrorHover: base.customizable.red.normal[88],
|
|
322
319
|
shapePaleErrorPressed: base.customizable.red.dim[88],
|
|
323
|
-
shapePaleNeutralAlpha: base.blackAlpha[
|
|
324
|
-
shapePaleNeutralAlphaHover: base.blackAlpha[
|
|
325
|
-
shapePaleNeutralAlphaPressed: base.blackAlpha[
|
|
320
|
+
shapePaleNeutralAlpha: base.blackAlpha[12],
|
|
321
|
+
shapePaleNeutralAlphaHover: base.blackAlpha[16],
|
|
322
|
+
shapePaleNeutralAlphaPressed: base.blackAlpha[24],
|
|
326
323
|
shapePaleSuccess: base.customizable.green.normal[92],
|
|
327
324
|
shapePaleSuccessHover: base.customizable.green.normal[88],
|
|
328
325
|
shapePaleSuccessPressed: base.customizable.green.dim[88],
|
|
@@ -365,12 +362,12 @@ var getDefaultTokens = function (base) {
|
|
|
365
362
|
shapeInvertedNeutralHeavy: base.gray[100],
|
|
366
363
|
shapeInvertedNeutralHeavyHover: base.whiteAlpha[88],
|
|
367
364
|
shapeInvertedNeutralHeavyPressed: base.whiteAlpha[72],
|
|
368
|
-
shapeInvertedNeutralPaleAlpha: base.whiteAlpha[
|
|
369
|
-
shapeInvertedNeutralPaleAlphaHover: base.whiteAlpha[
|
|
365
|
+
shapeInvertedNeutralPaleAlpha: base.whiteAlpha[12],
|
|
366
|
+
shapeInvertedNeutralPaleAlphaHover: base.whiteAlpha[16],
|
|
370
367
|
shapeInvertedNeutralPaleAlphaPressed: base.whiteAlpha[6],
|
|
371
368
|
shapeInvertedNeutralSoftAlpha: base.whiteAlpha[16],
|
|
372
369
|
shapeInvertedNeutralSoftAlphaHover: base.whiteAlpha[24],
|
|
373
|
-
shapeInvertedNeutralSoftAlphaPressed: base.whiteAlpha[
|
|
370
|
+
shapeInvertedNeutralSoftAlphaPressed: base.whiteAlpha[8],
|
|
374
371
|
shapeConstBacklessBlackHover: base.blackAlpha[12],
|
|
375
372
|
shapeConstBacklessBlackPressed: base.blackAlpha[16],
|
|
376
373
|
shapeConstBacklessWhiteHover: base.whiteAlpha[12],
|
|
@@ -520,21 +517,21 @@ var getDefaultTokens = function (base) {
|
|
|
520
517
|
illustrationWhite: base.gray[100],
|
|
521
518
|
customizableBoldBlack: base.gray[52],
|
|
522
519
|
customizableBoldBlue: base.customizable.blue.vivid[68],
|
|
523
|
-
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[
|
|
520
|
+
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[64],
|
|
524
521
|
customizableBoldGray: base.gray[72],
|
|
525
522
|
customizableBoldGreen: base.customizable.green.vivid[68],
|
|
526
|
-
customizableBoldMint: base.customizable.mint.vivid[
|
|
523
|
+
customizableBoldMint: base.customizable.mint.vivid[72],
|
|
527
524
|
customizableBoldOrange: base.customizable.orange.vivid[68],
|
|
528
525
|
customizableBoldPurple: base.customizable.purple.vivid[68],
|
|
529
526
|
customizableBoldRed: base.customizable.red.vivid[68],
|
|
530
527
|
customizableBoldViolet: base.customizable.violet.vivid[68],
|
|
531
|
-
customizableBoldYellow: base.customizable.yellow.vivid[
|
|
528
|
+
customizableBoldYellow: base.customizable.yellow.vivid[80],
|
|
532
529
|
customizableFaintBlack: base.gray[92],
|
|
533
530
|
customizableFaintBlue: base.customizable.blue.vivid[96],
|
|
534
531
|
customizableFaintBlueDeep: base.customizable.blueDeep.vivid[96],
|
|
535
532
|
customizableFaintGray: base.gray[96],
|
|
536
|
-
customizableFaintGreen: base.customizable.green.
|
|
537
|
-
customizableFaintMint: base.customizable.mint.
|
|
533
|
+
customizableFaintGreen: base.customizable.green.normal[96],
|
|
534
|
+
customizableFaintMint: base.customizable.mint.normal[96],
|
|
538
535
|
customizableFaintOrange: base.customizable.orange.vivid[96],
|
|
539
536
|
customizableFaintPurple: base.customizable.purple.vivid[96],
|
|
540
537
|
customizableFaintRed: base.customizable.red.vivid[96],
|
|
@@ -555,8 +552,8 @@ var getDefaultTokens = function (base) {
|
|
|
555
552
|
customizablePaleBlue: base.customizable.blue.vivid[92],
|
|
556
553
|
customizablePaleBlueDeep: base.customizable.blueDeep.vivid[92],
|
|
557
554
|
customizablePaleGray: base.gray[92],
|
|
558
|
-
customizablePaleGreen: base.customizable.green.
|
|
559
|
-
customizablePaleMint: base.customizable.mint.
|
|
555
|
+
customizablePaleGreen: base.customizable.green.normal[92],
|
|
556
|
+
customizablePaleMint: base.customizable.mint.normal[92],
|
|
560
557
|
customizablePaleOrange: base.customizable.orange.vivid[92],
|
|
561
558
|
customizablePalePurple: base.customizable.purple.vivid[92],
|
|
562
559
|
customizablePaleRed: base.customizable.red.vivid[92],
|
|
@@ -712,13 +709,13 @@ var getDefaultTokens = function (base) {
|
|
|
712
709
|
shapeOtherLowPressed: base.blackAlpha[32],
|
|
713
710
|
shapeOtherNeutralFaintSolid: base.gray[32],
|
|
714
711
|
shapeOtherNeutralFaintSolidHover: base.gray[36],
|
|
715
|
-
shapeOtherNeutralFaintSolidPressed: base.gray[
|
|
712
|
+
shapeOtherNeutralFaintSolidPressed: base.gray[32],
|
|
716
713
|
shapeOtherNeutralPaleSolid: base.gray[36],
|
|
717
714
|
shapeOtherNeutralPaleSolidHover: base.gray[40],
|
|
718
715
|
shapeOtherNeutralPaleSolidPressed: base.gray[32],
|
|
719
|
-
shapeOtherNeutralSoftSolid: base.gray[
|
|
716
|
+
shapeOtherNeutralSoftSolid: base.gray[40],
|
|
720
717
|
shapeOtherNeutralSoftSolidHover: base.gray[48],
|
|
721
|
-
shapeOtherNeutralSoftSolidPressed: base.gray[
|
|
718
|
+
shapeOtherNeutralSoftSolidPressed: base.gray[36],
|
|
722
719
|
shapePaleAccent:
|
|
723
720
|
((_84 = (_83 = base.accent) === null || _83 === void 0 ? void 0 : _83.palette) === null || _84 === void 0
|
|
724
721
|
? void 0
|
|
@@ -737,8 +734,8 @@ var getDefaultTokens = function (base) {
|
|
|
737
734
|
shapePaleError: base.customizable.red.dim[36],
|
|
738
735
|
shapePaleErrorHover: base.customizable.red.dim[40],
|
|
739
736
|
shapePaleErrorPressed: base.customizable.red.dim[32],
|
|
740
|
-
shapePaleNeutralAlpha: base.whiteAlpha[
|
|
741
|
-
shapePaleNeutralAlphaHover: base.whiteAlpha[
|
|
737
|
+
shapePaleNeutralAlpha: base.whiteAlpha[12],
|
|
738
|
+
shapePaleNeutralAlphaHover: base.whiteAlpha[16],
|
|
742
739
|
shapePaleNeutralAlphaPressed: base.whiteAlpha[6],
|
|
743
740
|
shapePaleSuccess: base.customizable.green.dim[36],
|
|
744
741
|
shapePaleSuccessHover: base.customizable.green.dim[40],
|
|
@@ -766,7 +763,7 @@ var getDefaultTokens = function (base) {
|
|
|
766
763
|
shapeSoftErrorPressed: base.customizable.red.dim[44],
|
|
767
764
|
shapeSoftNeutralAlpha: base.whiteAlpha[16],
|
|
768
765
|
shapeSoftNeutralAlphaHover: base.whiteAlpha[24],
|
|
769
|
-
shapeSoftNeutralAlphaPressed: base.whiteAlpha[
|
|
766
|
+
shapeSoftNeutralAlphaPressed: base.whiteAlpha[8],
|
|
770
767
|
shapeSoftSuccess: base.customizable.green.dim[48],
|
|
771
768
|
shapeSoftSuccessHover: base.customizable.green.dim[52],
|
|
772
769
|
shapeSoftSuccessPressed: base.customizable.green.dim[44],
|
|
@@ -774,17 +771,17 @@ var getDefaultTokens = function (base) {
|
|
|
774
771
|
shapeSoftWarningHover: base.warning.dim[56],
|
|
775
772
|
shapeSoftWarningPressed: base.warning.dim[48],
|
|
776
773
|
shapeInvertedBacklessHover: base.blackAlpha[6],
|
|
777
|
-
shapeInvertedBacklessPressed: base.blackAlpha[
|
|
774
|
+
shapeInvertedBacklessPressed: base.blackAlpha[16],
|
|
778
775
|
shapeInvertedDisabled: base.blackAlpha[6],
|
|
779
776
|
shapeInvertedNeutralFaintAlpha: base.blackAlpha[6],
|
|
780
|
-
shapeInvertedNeutralFaintAlphaHover: base.blackAlpha[
|
|
781
|
-
shapeInvertedNeutralFaintAlphaPressed: base.blackAlpha[
|
|
777
|
+
shapeInvertedNeutralFaintAlphaHover: base.blackAlpha[12],
|
|
778
|
+
shapeInvertedNeutralFaintAlphaPressed: base.blackAlpha[16],
|
|
782
779
|
shapeInvertedNeutralHeavy: base.blackAlpha[80],
|
|
783
780
|
shapeInvertedNeutralHeavyHover: base.blackAlpha[88],
|
|
784
781
|
shapeInvertedNeutralHeavyPressed: base.blackAlpha[72],
|
|
785
|
-
shapeInvertedNeutralPaleAlpha: base.blackAlpha[
|
|
786
|
-
shapeInvertedNeutralPaleAlphaHover: base.blackAlpha[
|
|
787
|
-
shapeInvertedNeutralPaleAlphaPressed: base.blackAlpha[
|
|
782
|
+
shapeInvertedNeutralPaleAlpha: base.blackAlpha[12],
|
|
783
|
+
shapeInvertedNeutralPaleAlphaHover: base.blackAlpha[16],
|
|
784
|
+
shapeInvertedNeutralPaleAlphaPressed: base.blackAlpha[24],
|
|
788
785
|
shapeInvertedNeutralSoftAlpha: base.blackAlpha[16],
|
|
789
786
|
shapeInvertedNeutralSoftAlphaHover: base.blackAlpha[24],
|
|
790
787
|
shapeInvertedNeutralSoftAlphaPressed: base.blackAlpha[32],
|
|
@@ -937,15 +934,15 @@ var getDefaultTokens = function (base) {
|
|
|
937
934
|
illustrationWhite: base.gray[100],
|
|
938
935
|
customizableBoldBlack: base.gray[76],
|
|
939
936
|
customizableBoldBlue: base.customizable.blue.normal[64],
|
|
940
|
-
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[
|
|
937
|
+
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[60],
|
|
941
938
|
customizableBoldGray: base.gray[52],
|
|
942
939
|
customizableBoldGreen: base.customizable.green.normal[64],
|
|
943
|
-
customizableBoldMint: base.customizable.mint.normal[
|
|
944
|
-
customizableBoldOrange: base.customizable.orange.normal[
|
|
940
|
+
customizableBoldMint: base.customizable.mint.normal[68],
|
|
941
|
+
customizableBoldOrange: base.customizable.orange.normal[68],
|
|
945
942
|
customizableBoldPurple: base.customizable.purple.normal[64],
|
|
946
943
|
customizableBoldRed: base.customizable.red.normal[64],
|
|
947
944
|
customizableBoldViolet: base.customizable.violet.normal[64],
|
|
948
|
-
customizableBoldYellow: base.customizable.yellow.vivid[
|
|
945
|
+
customizableBoldYellow: base.customizable.yellow.vivid[76],
|
|
949
946
|
customizableFaintBlack: base.gray[40],
|
|
950
947
|
customizableFaintBlue: base.customizable.blue.dim[32],
|
|
951
948
|
customizableFaintBlueDeep: base.customizable.blueDeep.dim[32],
|
|
@@ -993,4 +990,3 @@ var getDefaultTokens = function (base) {
|
|
|
993
990
|
},
|
|
994
991
|
};
|
|
995
992
|
};
|
|
996
|
-
exports.getDefaultTokens = getDefaultTokens;
|
package/dist/esm/get-colors.d.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { type ConfigOptions
|
|
2
|
-
import {
|
|
3
|
-
import type {
|
|
4
|
-
export interface Themed<T> {
|
|
5
|
-
light: T;
|
|
6
|
-
dark: T;
|
|
7
|
-
}
|
|
8
|
-
export type DefaultTokensFull = ReturnType<typeof getDefaultTokens>;
|
|
9
|
-
export type DefaultTokens = DefaultTokensFull['light' | 'dark'];
|
|
1
|
+
import { type ConfigOptions } from './get-colors-base.js';
|
|
2
|
+
import type { BaseTokens } from './types/tokens-base.js';
|
|
3
|
+
import type { DefaultTokens, DefaultTokensFull, Themed } from './types/tokens.js';
|
|
10
4
|
export interface SemanticConfigOptions<T> extends ConfigOptions {
|
|
11
5
|
theme?: 'light' | 'dark';
|
|
12
6
|
overrides?: (base: BaseTokens, defaults?: DefaultTokensFull, params?: SemanticConfigOptions<T>) => Themed<T>;
|
|
13
|
-
format?: ColorFormat;
|
|
14
7
|
}
|
|
15
8
|
export declare function getColors(params: SemanticConfigOptions<DefaultTokens>): DefaultTokens;
|
|
16
9
|
export declare function getColors<T>(
|
package/dist/esm/get-colors.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
var DEFAULT_THEME = 'light';
|
|
1
|
+
import { getColorsBase } from './get-colors-base.js';
|
|
2
|
+
import { getColorsDefaultTokens } from './get-colors-default-tokens.js';
|
|
4
3
|
export function getColors(params) {
|
|
5
|
-
var theme = params.theme ||
|
|
6
|
-
var base =
|
|
7
|
-
var defaults =
|
|
4
|
+
var theme = params.theme || 'light';
|
|
5
|
+
var base = getColorsBase(params);
|
|
6
|
+
var defaults = getColorsDefaultTokens(base);
|
|
8
7
|
var result;
|
|
9
8
|
if (params.overrides) {
|
|
10
9
|
result = params.overrides(base, defaults, params)[theme];
|
|
11
10
|
} else {
|
|
12
11
|
result = defaults[theme];
|
|
13
12
|
}
|
|
14
|
-
|
|
15
|
-
return finalResult;
|
|
13
|
+
return result;
|
|
16
14
|
}
|
|
@@ -265,8 +265,8 @@ export var getDefaultTokens = function (base) {
|
|
|
265
265
|
shapeFaintErrorHover: base.customizable.red.normal[92],
|
|
266
266
|
shapeFaintErrorPressed: base.customizable.red.dim[92],
|
|
267
267
|
shapeFaintNeutralAlpha: base.blackAlpha[6],
|
|
268
|
-
shapeFaintNeutralAlphaHover: base.blackAlpha[
|
|
269
|
-
shapeFaintNeutralAlphaPressed: base.blackAlpha[
|
|
268
|
+
shapeFaintNeutralAlphaHover: base.blackAlpha[12],
|
|
269
|
+
shapeFaintNeutralAlphaPressed: base.blackAlpha[16],
|
|
270
270
|
shapeFaintSuccess: base.customizable.green.normal[96],
|
|
271
271
|
shapeFaintSuccessHover: base.customizable.green.normal[92],
|
|
272
272
|
shapeFaintSuccessPressed: base.customizable.green.dim[92],
|
|
@@ -279,7 +279,7 @@ export var getDefaultTokens = function (base) {
|
|
|
279
279
|
shapeHeavyWarning: base.warning.vivid[36],
|
|
280
280
|
shapeOtherAccentBoldDisabled: base.blackAlpha[32],
|
|
281
281
|
shapeOtherBacklessHover: base.blackAlpha[6],
|
|
282
|
-
shapeOtherBacklessPressed: base.blackAlpha[
|
|
282
|
+
shapeOtherBacklessPressed: base.blackAlpha[16],
|
|
283
283
|
shapeOtherBase: base.gray[100],
|
|
284
284
|
shapeOtherBaseHover: base.gray[96],
|
|
285
285
|
shapeOtherBasePressed: base.gray[92],
|
|
@@ -296,7 +296,7 @@ export var getDefaultTokens = function (base) {
|
|
|
296
296
|
shapeOtherNeutralPaleSolid: base.gray[92],
|
|
297
297
|
shapeOtherNeutralPaleSolidHover: base.gray[88],
|
|
298
298
|
shapeOtherNeutralPaleSolidPressed: base.gray[84],
|
|
299
|
-
shapeOtherNeutralSoftSolid: base.gray[
|
|
299
|
+
shapeOtherNeutralSoftSolid: base.gray[88],
|
|
300
300
|
shapeOtherNeutralSoftSolidHover: base.gray[80],
|
|
301
301
|
shapeOtherNeutralSoftSolidPressed: base.gray[76],
|
|
302
302
|
shapePaleAccent:
|
|
@@ -317,9 +317,9 @@ export var getDefaultTokens = function (base) {
|
|
|
317
317
|
shapePaleError: base.customizable.red.vivid[92],
|
|
318
318
|
shapePaleErrorHover: base.customizable.red.normal[88],
|
|
319
319
|
shapePaleErrorPressed: base.customizable.red.dim[88],
|
|
320
|
-
shapePaleNeutralAlpha: base.blackAlpha[
|
|
321
|
-
shapePaleNeutralAlphaHover: base.blackAlpha[
|
|
322
|
-
shapePaleNeutralAlphaPressed: base.blackAlpha[
|
|
320
|
+
shapePaleNeutralAlpha: base.blackAlpha[12],
|
|
321
|
+
shapePaleNeutralAlphaHover: base.blackAlpha[16],
|
|
322
|
+
shapePaleNeutralAlphaPressed: base.blackAlpha[24],
|
|
323
323
|
shapePaleSuccess: base.customizable.green.normal[92],
|
|
324
324
|
shapePaleSuccessHover: base.customizable.green.normal[88],
|
|
325
325
|
shapePaleSuccessPressed: base.customizable.green.dim[88],
|
|
@@ -362,12 +362,12 @@ export var getDefaultTokens = function (base) {
|
|
|
362
362
|
shapeInvertedNeutralHeavy: base.gray[100],
|
|
363
363
|
shapeInvertedNeutralHeavyHover: base.whiteAlpha[88],
|
|
364
364
|
shapeInvertedNeutralHeavyPressed: base.whiteAlpha[72],
|
|
365
|
-
shapeInvertedNeutralPaleAlpha: base.whiteAlpha[
|
|
366
|
-
shapeInvertedNeutralPaleAlphaHover: base.whiteAlpha[
|
|
365
|
+
shapeInvertedNeutralPaleAlpha: base.whiteAlpha[12],
|
|
366
|
+
shapeInvertedNeutralPaleAlphaHover: base.whiteAlpha[16],
|
|
367
367
|
shapeInvertedNeutralPaleAlphaPressed: base.whiteAlpha[6],
|
|
368
368
|
shapeInvertedNeutralSoftAlpha: base.whiteAlpha[16],
|
|
369
369
|
shapeInvertedNeutralSoftAlphaHover: base.whiteAlpha[24],
|
|
370
|
-
shapeInvertedNeutralSoftAlphaPressed: base.whiteAlpha[
|
|
370
|
+
shapeInvertedNeutralSoftAlphaPressed: base.whiteAlpha[8],
|
|
371
371
|
shapeConstBacklessBlackHover: base.blackAlpha[12],
|
|
372
372
|
shapeConstBacklessBlackPressed: base.blackAlpha[16],
|
|
373
373
|
shapeConstBacklessWhiteHover: base.whiteAlpha[12],
|
|
@@ -517,21 +517,21 @@ export var getDefaultTokens = function (base) {
|
|
|
517
517
|
illustrationWhite: base.gray[100],
|
|
518
518
|
customizableBoldBlack: base.gray[52],
|
|
519
519
|
customizableBoldBlue: base.customizable.blue.vivid[68],
|
|
520
|
-
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[
|
|
520
|
+
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[64],
|
|
521
521
|
customizableBoldGray: base.gray[72],
|
|
522
522
|
customizableBoldGreen: base.customizable.green.vivid[68],
|
|
523
|
-
customizableBoldMint: base.customizable.mint.vivid[
|
|
523
|
+
customizableBoldMint: base.customizable.mint.vivid[72],
|
|
524
524
|
customizableBoldOrange: base.customizable.orange.vivid[68],
|
|
525
525
|
customizableBoldPurple: base.customizable.purple.vivid[68],
|
|
526
526
|
customizableBoldRed: base.customizable.red.vivid[68],
|
|
527
527
|
customizableBoldViolet: base.customizable.violet.vivid[68],
|
|
528
|
-
customizableBoldYellow: base.customizable.yellow.vivid[
|
|
528
|
+
customizableBoldYellow: base.customizable.yellow.vivid[80],
|
|
529
529
|
customizableFaintBlack: base.gray[92],
|
|
530
530
|
customizableFaintBlue: base.customizable.blue.vivid[96],
|
|
531
531
|
customizableFaintBlueDeep: base.customizable.blueDeep.vivid[96],
|
|
532
532
|
customizableFaintGray: base.gray[96],
|
|
533
|
-
customizableFaintGreen: base.customizable.green.
|
|
534
|
-
customizableFaintMint: base.customizable.mint.
|
|
533
|
+
customizableFaintGreen: base.customizable.green.normal[96],
|
|
534
|
+
customizableFaintMint: base.customizable.mint.normal[96],
|
|
535
535
|
customizableFaintOrange: base.customizable.orange.vivid[96],
|
|
536
536
|
customizableFaintPurple: base.customizable.purple.vivid[96],
|
|
537
537
|
customizableFaintRed: base.customizable.red.vivid[96],
|
|
@@ -552,8 +552,8 @@ export var getDefaultTokens = function (base) {
|
|
|
552
552
|
customizablePaleBlue: base.customizable.blue.vivid[92],
|
|
553
553
|
customizablePaleBlueDeep: base.customizable.blueDeep.vivid[92],
|
|
554
554
|
customizablePaleGray: base.gray[92],
|
|
555
|
-
customizablePaleGreen: base.customizable.green.
|
|
556
|
-
customizablePaleMint: base.customizable.mint.
|
|
555
|
+
customizablePaleGreen: base.customizable.green.normal[92],
|
|
556
|
+
customizablePaleMint: base.customizable.mint.normal[92],
|
|
557
557
|
customizablePaleOrange: base.customizable.orange.vivid[92],
|
|
558
558
|
customizablePalePurple: base.customizable.purple.vivid[92],
|
|
559
559
|
customizablePaleRed: base.customizable.red.vivid[92],
|
|
@@ -709,13 +709,13 @@ export var getDefaultTokens = function (base) {
|
|
|
709
709
|
shapeOtherLowPressed: base.blackAlpha[32],
|
|
710
710
|
shapeOtherNeutralFaintSolid: base.gray[32],
|
|
711
711
|
shapeOtherNeutralFaintSolidHover: base.gray[36],
|
|
712
|
-
shapeOtherNeutralFaintSolidPressed: base.gray[
|
|
712
|
+
shapeOtherNeutralFaintSolidPressed: base.gray[32],
|
|
713
713
|
shapeOtherNeutralPaleSolid: base.gray[36],
|
|
714
714
|
shapeOtherNeutralPaleSolidHover: base.gray[40],
|
|
715
715
|
shapeOtherNeutralPaleSolidPressed: base.gray[32],
|
|
716
|
-
shapeOtherNeutralSoftSolid: base.gray[
|
|
716
|
+
shapeOtherNeutralSoftSolid: base.gray[40],
|
|
717
717
|
shapeOtherNeutralSoftSolidHover: base.gray[48],
|
|
718
|
-
shapeOtherNeutralSoftSolidPressed: base.gray[
|
|
718
|
+
shapeOtherNeutralSoftSolidPressed: base.gray[36],
|
|
719
719
|
shapePaleAccent:
|
|
720
720
|
((_84 = (_83 = base.accent) === null || _83 === void 0 ? void 0 : _83.palette) === null || _84 === void 0
|
|
721
721
|
? void 0
|
|
@@ -734,8 +734,8 @@ export var getDefaultTokens = function (base) {
|
|
|
734
734
|
shapePaleError: base.customizable.red.dim[36],
|
|
735
735
|
shapePaleErrorHover: base.customizable.red.dim[40],
|
|
736
736
|
shapePaleErrorPressed: base.customizable.red.dim[32],
|
|
737
|
-
shapePaleNeutralAlpha: base.whiteAlpha[
|
|
738
|
-
shapePaleNeutralAlphaHover: base.whiteAlpha[
|
|
737
|
+
shapePaleNeutralAlpha: base.whiteAlpha[12],
|
|
738
|
+
shapePaleNeutralAlphaHover: base.whiteAlpha[16],
|
|
739
739
|
shapePaleNeutralAlphaPressed: base.whiteAlpha[6],
|
|
740
740
|
shapePaleSuccess: base.customizable.green.dim[36],
|
|
741
741
|
shapePaleSuccessHover: base.customizable.green.dim[40],
|
|
@@ -763,7 +763,7 @@ export var getDefaultTokens = function (base) {
|
|
|
763
763
|
shapeSoftErrorPressed: base.customizable.red.dim[44],
|
|
764
764
|
shapeSoftNeutralAlpha: base.whiteAlpha[16],
|
|
765
765
|
shapeSoftNeutralAlphaHover: base.whiteAlpha[24],
|
|
766
|
-
shapeSoftNeutralAlphaPressed: base.whiteAlpha[
|
|
766
|
+
shapeSoftNeutralAlphaPressed: base.whiteAlpha[8],
|
|
767
767
|
shapeSoftSuccess: base.customizable.green.dim[48],
|
|
768
768
|
shapeSoftSuccessHover: base.customizable.green.dim[52],
|
|
769
769
|
shapeSoftSuccessPressed: base.customizable.green.dim[44],
|
|
@@ -771,17 +771,17 @@ export var getDefaultTokens = function (base) {
|
|
|
771
771
|
shapeSoftWarningHover: base.warning.dim[56],
|
|
772
772
|
shapeSoftWarningPressed: base.warning.dim[48],
|
|
773
773
|
shapeInvertedBacklessHover: base.blackAlpha[6],
|
|
774
|
-
shapeInvertedBacklessPressed: base.blackAlpha[
|
|
774
|
+
shapeInvertedBacklessPressed: base.blackAlpha[16],
|
|
775
775
|
shapeInvertedDisabled: base.blackAlpha[6],
|
|
776
776
|
shapeInvertedNeutralFaintAlpha: base.blackAlpha[6],
|
|
777
|
-
shapeInvertedNeutralFaintAlphaHover: base.blackAlpha[
|
|
778
|
-
shapeInvertedNeutralFaintAlphaPressed: base.blackAlpha[
|
|
777
|
+
shapeInvertedNeutralFaintAlphaHover: base.blackAlpha[12],
|
|
778
|
+
shapeInvertedNeutralFaintAlphaPressed: base.blackAlpha[16],
|
|
779
779
|
shapeInvertedNeutralHeavy: base.blackAlpha[80],
|
|
780
780
|
shapeInvertedNeutralHeavyHover: base.blackAlpha[88],
|
|
781
781
|
shapeInvertedNeutralHeavyPressed: base.blackAlpha[72],
|
|
782
|
-
shapeInvertedNeutralPaleAlpha: base.blackAlpha[
|
|
783
|
-
shapeInvertedNeutralPaleAlphaHover: base.blackAlpha[
|
|
784
|
-
shapeInvertedNeutralPaleAlphaPressed: base.blackAlpha[
|
|
782
|
+
shapeInvertedNeutralPaleAlpha: base.blackAlpha[12],
|
|
783
|
+
shapeInvertedNeutralPaleAlphaHover: base.blackAlpha[16],
|
|
784
|
+
shapeInvertedNeutralPaleAlphaPressed: base.blackAlpha[24],
|
|
785
785
|
shapeInvertedNeutralSoftAlpha: base.blackAlpha[16],
|
|
786
786
|
shapeInvertedNeutralSoftAlphaHover: base.blackAlpha[24],
|
|
787
787
|
shapeInvertedNeutralSoftAlphaPressed: base.blackAlpha[32],
|
|
@@ -934,15 +934,15 @@ export var getDefaultTokens = function (base) {
|
|
|
934
934
|
illustrationWhite: base.gray[100],
|
|
935
935
|
customizableBoldBlack: base.gray[76],
|
|
936
936
|
customizableBoldBlue: base.customizable.blue.normal[64],
|
|
937
|
-
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[
|
|
937
|
+
customizableBoldBlueDeep: base.customizable.blueDeep.vivid[60],
|
|
938
938
|
customizableBoldGray: base.gray[52],
|
|
939
939
|
customizableBoldGreen: base.customizable.green.normal[64],
|
|
940
|
-
customizableBoldMint: base.customizable.mint.normal[
|
|
941
|
-
customizableBoldOrange: base.customizable.orange.normal[
|
|
940
|
+
customizableBoldMint: base.customizable.mint.normal[68],
|
|
941
|
+
customizableBoldOrange: base.customizable.orange.normal[68],
|
|
942
942
|
customizableBoldPurple: base.customizable.purple.normal[64],
|
|
943
943
|
customizableBoldRed: base.customizable.red.normal[64],
|
|
944
944
|
customizableBoldViolet: base.customizable.violet.normal[64],
|
|
945
|
-
customizableBoldYellow: base.customizable.yellow.vivid[
|
|
945
|
+
customizableBoldYellow: base.customizable.yellow.vivid[76],
|
|
946
946
|
customizableFaintBlack: base.gray[40],
|
|
947
947
|
customizableFaintBlue: base.customizable.blue.dim[32],
|
|
948
948
|
customizableFaintBlueDeep: base.customizable.blueDeep.dim[32],
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
PRESSED_LIGHT_C,
|
|
9
9
|
PRESSED_DARK_L,
|
|
10
10
|
PRESSED_DARK_C,
|
|
11
|
-
} from '../
|
|
11
|
+
} from '../consts/params/interactions.js';
|
|
12
12
|
function applyOklchDelta(oklchColor, dL, dC) {
|
|
13
13
|
var _a = oklchColor.l,
|
|
14
14
|
l = _a === void 0 ? 0 : _a,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { converter } from 'culori';
|
|
2
|
-
import {
|
|
2
|
+
import { LOGO_LIGHTNESS_MIN } from '../consts/params/logo-lightness.js';
|
|
3
3
|
export function getLogo(hex) {
|
|
4
4
|
var toOklch = converter('oklch');
|
|
5
5
|
var oklchColor = toOklch(hex);
|
|
6
6
|
var lightThemeLogoColor = hex;
|
|
7
7
|
if (!oklchColor) {
|
|
8
|
-
var fallbackColor = 'oklch('.concat(
|
|
8
|
+
var fallbackColor = 'oklch('.concat(LOGO_LIGHTNESS_MIN, '% 0 0)');
|
|
9
9
|
return { light: hex, dark: fallbackColor };
|
|
10
10
|
}
|
|
11
11
|
var _a = oklchColor.l,
|
|
@@ -17,8 +17,8 @@ export function getLogo(hex) {
|
|
|
17
17
|
l = l || 0;
|
|
18
18
|
c = c || 0;
|
|
19
19
|
var percentL = l * 100;
|
|
20
|
-
if (percentL <
|
|
21
|
-
l =
|
|
20
|
+
if (percentL < LOGO_LIGHTNESS_MIN) {
|
|
21
|
+
l = LOGO_LIGHTNESS_MIN / 100;
|
|
22
22
|
}
|
|
23
23
|
var darkThemeLogoColor = 'oklch('.concat(l.toFixed(3), ' ').concat(c.toFixed(3), ' ').concat(safeH.toFixed(0), ')');
|
|
24
24
|
return {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
GeneratorColorAbneyCorrection,
|
|
3
|
-
|
|
3
|
+
GeneratorColorChromaParamsGroup,
|
|
4
4
|
GeneratorColorPalette,
|
|
5
5
|
GeneratorColorWarningHuePatch,
|
|
6
|
-
} from '../types/generator
|
|
6
|
+
} from '../types/tokens-base-generator.js';
|
|
7
7
|
interface GeneratePaletteParams {
|
|
8
8
|
color: string;
|
|
9
9
|
type?: 'default' | 'warning';
|
|
10
10
|
settings?: {
|
|
11
|
-
chromaSettings?:
|
|
11
|
+
chromaSettings?: GeneratorColorChromaParamsGroup;
|
|
12
12
|
abneyCorrection?: GeneratorColorAbneyCorrection;
|
|
13
13
|
promoHueShifts?: {
|
|
14
14
|
[hueRange: number]: number;
|
|
@@ -26,18 +26,18 @@ var __spreadArray =
|
|
|
26
26
|
};
|
|
27
27
|
import { clampChroma, converter } from 'culori';
|
|
28
28
|
import { calcAPCA } from 'apca-w3';
|
|
29
|
-
import * as DefaultSwatch from '../
|
|
30
|
-
import {
|
|
31
|
-
import { ABNEY_CORRECTION } from '../
|
|
32
|
-
import { PROMO_HUE_SHIFTS } from '../
|
|
33
|
-
import { WARNING_HUE_PATCH } from '../
|
|
29
|
+
import * as DefaultSwatch from '../consts/default-swatch.js';
|
|
30
|
+
import { CHROMA_PARAMS } from '../consts/params/chroma-params.js';
|
|
31
|
+
import { ABNEY_CORRECTION } from '../consts/params/abney-correction.js';
|
|
32
|
+
import { PROMO_HUE_SHIFTS } from '../consts/params/promo-hue-shift.js';
|
|
33
|
+
import { WARNING_HUE_PATCH } from '../consts/params/warning-hue-patch.js';
|
|
34
34
|
export function getPalette(_a) {
|
|
35
35
|
var color = _a.color,
|
|
36
36
|
_b = _a.type,
|
|
37
37
|
type = _b === void 0 ? 'default' : _b,
|
|
38
38
|
customSettings = _a.settings;
|
|
39
39
|
var defaultSettings = {
|
|
40
|
-
chromaSettings:
|
|
40
|
+
chromaSettings: CHROMA_PARAMS,
|
|
41
41
|
abneyCorrection: ABNEY_CORRECTION,
|
|
42
42
|
promoHueShifts: PROMO_HUE_SHIFTS,
|
|
43
43
|
warningHuePatch: WARNING_HUE_PATCH,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clampChroma, converter, formatHex } from 'culori';
|
|
2
|
-
import { PROMO_HUE_SHIFTS } from '../
|
|
2
|
+
import { PROMO_HUE_SHIFTS } from '../consts/params/promo-hue-shift.js';
|
|
3
3
|
export function getPromo(color, hueShifts) {
|
|
4
4
|
if (hueShifts === void 0) {
|
|
5
5
|
hueShifts = PROMO_HUE_SHIFTS;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface GeneratorColorChromaParamsGroup {
|
|
2
2
|
[key: number]: {
|
|
3
3
|
vivid: GeneratorColorChromaSettings;
|
|
4
4
|
normal: GeneratorColorChromaSettings;
|
|
@@ -33,7 +33,7 @@ export interface GeneratorPaletteParams {
|
|
|
33
33
|
color: string;
|
|
34
34
|
type?: 'default' | 'warning' | 'promo';
|
|
35
35
|
settings?: {
|
|
36
|
-
chromaSettings?:
|
|
36
|
+
chromaSettings?: GeneratorColorChromaParamsGroup;
|
|
37
37
|
abneyCorrection?: GeneratorColorAbneyCorrection;
|
|
38
38
|
promoHueShifts?: {
|
|
39
39
|
[hueRange: number]: number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { getColorsDefaultTokens } from '../get-colors-default-tokens.js';
|
|
2
|
+
export interface Themed<T> {
|
|
3
|
+
light: T;
|
|
4
|
+
dark: T;
|
|
5
|
+
}
|
|
6
|
+
export interface ColorObject {
|
|
7
|
+
[key: string]: ColorValue;
|
|
8
|
+
}
|
|
9
|
+
export type ColorValue = string | ColorObject | ColorValue[];
|
|
10
|
+
export type ColorStructure = ColorObject | ColorValue[];
|
|
11
|
+
export type DefaultTokensFull = ReturnType<typeof getColorsDefaultTokens>;
|
|
12
|
+
export type DefaultTokens = DefaultTokensFull['light' | 'dark'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|