@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
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.CHROMA_SETTINGS = void 0;
|
|
4
|
-
exports.CHROMA_SETTINGS = {
|
|
5
|
-
20: {
|
|
6
|
-
vivid: { rel: 100, max: 12 },
|
|
7
|
-
normal: { rel: 66, min: 4.4, max: 8 },
|
|
8
|
-
dim: { rel: 46, min: 2, max: 4.4 },
|
|
9
|
-
},
|
|
10
|
-
24: {
|
|
11
|
-
vivid: { rel: 100, max: 14.2 },
|
|
12
|
-
normal: { rel: 68, min: 5.7, max: 10 },
|
|
13
|
-
dim: { rel: 48, min: 2.8, max: 5.7 },
|
|
14
|
-
},
|
|
15
|
-
28: {
|
|
16
|
-
vivid: { rel: 100, max: 15.8 },
|
|
17
|
-
normal: { rel: 70, min: 7, max: 11.8 },
|
|
18
|
-
dim: { rel: 50, min: 3.6, max: 7 },
|
|
19
|
-
},
|
|
20
|
-
32: {
|
|
21
|
-
vivid: { rel: 100, max: 17.1 },
|
|
22
|
-
normal: { rel: 72, min: 8.2, max: 13.2 },
|
|
23
|
-
dim: { rel: 52, min: 4.4, max: 8.2 },
|
|
24
|
-
},
|
|
25
|
-
36: {
|
|
26
|
-
vivid: { rel: 100, max: 18 },
|
|
27
|
-
normal: { rel: 74, min: 9.4, max: 14.4 },
|
|
28
|
-
dim: { rel: 54, min: 5.2, max: 9.4 },
|
|
29
|
-
},
|
|
30
|
-
40: {
|
|
31
|
-
vivid: { rel: 100, max: 18.8 },
|
|
32
|
-
normal: { rel: 76, min: 10.6, max: 15.6 },
|
|
33
|
-
dim: { rel: 56, min: 6, max: 10.6 },
|
|
34
|
-
},
|
|
35
|
-
44: {
|
|
36
|
-
vivid: { rel: 100, max: 19.6 },
|
|
37
|
-
normal: { rel: 78, min: 11.7, max: 16.6 },
|
|
38
|
-
dim: { rel: 58, min: 6.8, max: 11.7 },
|
|
39
|
-
},
|
|
40
|
-
48: {
|
|
41
|
-
vivid: { rel: 100, max: 20.3 },
|
|
42
|
-
normal: { rel: 80, min: 12.8, max: 17.5 },
|
|
43
|
-
dim: { rel: 60, min: 7.6, max: 12.8 },
|
|
44
|
-
},
|
|
45
|
-
52: {
|
|
46
|
-
vivid: { rel: 100, max: 21 },
|
|
47
|
-
normal: { rel: 82, min: 13.9, max: 18.4 },
|
|
48
|
-
dim: { rel: 62, min: 8.4, max: 13.9 },
|
|
49
|
-
},
|
|
50
|
-
56: {
|
|
51
|
-
vivid: { rel: 100, max: 21.6 },
|
|
52
|
-
normal: { rel: 84, min: 15, max: 19.2 },
|
|
53
|
-
dim: { rel: 64, min: 9.2, max: 15 },
|
|
54
|
-
},
|
|
55
|
-
60: {
|
|
56
|
-
vivid: { rel: 100, max: 22 },
|
|
57
|
-
normal: { rel: 86, min: 15.9, max: 19.9 },
|
|
58
|
-
dim: { rel: 66, min: 9.9, max: 15.9 },
|
|
59
|
-
},
|
|
60
|
-
64: {
|
|
61
|
-
vivid: { rel: 100, max: 22.2 },
|
|
62
|
-
normal: { rel: 88, min: 16.2, max: 20.2 },
|
|
63
|
-
dim: { rel: 68, min: 10.2, max: 16.2 },
|
|
64
|
-
},
|
|
65
|
-
68: {
|
|
66
|
-
vivid: { rel: 100, max: 21.9 },
|
|
67
|
-
normal: { rel: 90, min: 15.8, max: 19.8 },
|
|
68
|
-
dim: { rel: 70, min: 9.6, max: 15.8 },
|
|
69
|
-
},
|
|
70
|
-
72: {
|
|
71
|
-
vivid: { rel: 100, max: 21.2 },
|
|
72
|
-
normal: { rel: 92, min: 14.8, max: 18.8 },
|
|
73
|
-
dim: { rel: 72, min: 8.4, max: 14.8 },
|
|
74
|
-
},
|
|
75
|
-
76: {
|
|
76
|
-
vivid: { rel: 100, max: 20.3 },
|
|
77
|
-
normal: { rel: 90, min: 13.1, max: 17.5 },
|
|
78
|
-
dim: { rel: 70, min: 7, max: 13.1 },
|
|
79
|
-
},
|
|
80
|
-
80: {
|
|
81
|
-
vivid: { rel: 100, max: 19 },
|
|
82
|
-
normal: { rel: 88, min: 11.2, max: 15.6 },
|
|
83
|
-
dim: { rel: 68, min: 5.6, max: 11.2 },
|
|
84
|
-
},
|
|
85
|
-
84: {
|
|
86
|
-
vivid: { rel: 100, max: 17.1 },
|
|
87
|
-
normal: { rel: 86, min: 9, max: 13.4 },
|
|
88
|
-
dim: { rel: 66, min: 4.4, max: 9 },
|
|
89
|
-
},
|
|
90
|
-
88: {
|
|
91
|
-
vivid: { rel: 100, max: 14.2 },
|
|
92
|
-
normal: { rel: 84, min: 6.7, max: 10.4 },
|
|
93
|
-
dim: { rel: 64, min: 3.2, max: 6.7 },
|
|
94
|
-
},
|
|
95
|
-
92: {
|
|
96
|
-
vivid: { rel: 100, max: 11 },
|
|
97
|
-
normal: { rel: 82, min: 4.4, max: 7.4 },
|
|
98
|
-
dim: { rel: 62, min: 2.2, max: 4.4 },
|
|
99
|
-
},
|
|
100
|
-
96: {
|
|
101
|
-
vivid: { rel: 100, max: 7 },
|
|
102
|
-
normal: { rel: 80, min: 2.6, max: 4.4 },
|
|
103
|
-
dim: { rel: 60, min: 1.5, max: 2.6 },
|
|
104
|
-
},
|
|
105
|
-
};
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.blackAlpha = exports.whiteAlpha = exports.gray = exports.customizable = exports.system = exports.brand = void 0;
|
|
4
|
-
exports.brand = {
|
|
5
|
-
red: '#FE4C4C',
|
|
6
|
-
orange: '#FC7630',
|
|
7
|
-
green: '#26AD50',
|
|
8
|
-
mint: '#00BEA2',
|
|
9
|
-
blue: '#2291FF',
|
|
10
|
-
blueDeep: '#366AF3',
|
|
11
|
-
violet: '#844BEC',
|
|
12
|
-
purple: '#B750D1',
|
|
13
|
-
};
|
|
14
|
-
exports.system = {
|
|
15
|
-
warning: '#FDAA00',
|
|
16
|
-
error: '#E62B34',
|
|
17
|
-
success: '#009A40',
|
|
18
|
-
accent: '#2291FF',
|
|
19
|
-
};
|
|
20
|
-
exports.customizable = {
|
|
21
|
-
red: '#FE4C4C',
|
|
22
|
-
orange: '#FC7630',
|
|
23
|
-
green: '#26AD50',
|
|
24
|
-
mint: '#00BEA2',
|
|
25
|
-
blue: '#2291FF',
|
|
26
|
-
blueDeep: '#366AF3',
|
|
27
|
-
violet: '#844BEC',
|
|
28
|
-
purple: '#B750D1',
|
|
29
|
-
yellow: '#FAB700',
|
|
30
|
-
};
|
|
31
|
-
exports.gray = {
|
|
32
|
-
0: 'oklch(0% 0 0)',
|
|
33
|
-
16: 'oklch(16% 0 0)',
|
|
34
|
-
20: 'oklch(20% 0 0)',
|
|
35
|
-
24: 'oklch(24% 0 0)',
|
|
36
|
-
28: 'oklch(28% 0 0)',
|
|
37
|
-
32: 'oklch(32% 0 0)',
|
|
38
|
-
36: 'oklch(36% 0 0)',
|
|
39
|
-
40: 'oklch(40% 0 0)',
|
|
40
|
-
44: 'oklch(44% 0 0)',
|
|
41
|
-
48: 'oklch(48% 0 0)',
|
|
42
|
-
52: 'oklch(52% 0 0)',
|
|
43
|
-
56: 'oklch(56% 0 0)',
|
|
44
|
-
60: 'oklch(60% 0 0)',
|
|
45
|
-
64: 'oklch(64% 0 0)',
|
|
46
|
-
68: 'oklch(68% 0 0)',
|
|
47
|
-
72: 'oklch(72% 0 0)',
|
|
48
|
-
76: 'oklch(76% 0 0)',
|
|
49
|
-
80: 'oklch(80% 0 0)',
|
|
50
|
-
84: 'oklch(84% 0 0)',
|
|
51
|
-
88: 'oklch(88% 0 0)',
|
|
52
|
-
92: 'oklch(92% 0 0)',
|
|
53
|
-
96: 'oklch(96% 0 0)',
|
|
54
|
-
98: 'oklch(98% 0 0)',
|
|
55
|
-
100: 'oklch(100% 0 0)',
|
|
56
|
-
};
|
|
57
|
-
exports.whiteAlpha = {
|
|
58
|
-
4: 'oklch(100% 0 0 / 0.04)',
|
|
59
|
-
6: 'oklch(100% 0 0 / 0.06)',
|
|
60
|
-
8: 'oklch(100% 0 0 / 0.08)',
|
|
61
|
-
12: 'oklch(100% 0 0 / 0.12)',
|
|
62
|
-
16: 'oklch(100% 0 0 / 0.16)',
|
|
63
|
-
20: 'oklch(100% 0 0 / 0.2)',
|
|
64
|
-
24: 'oklch(100% 0 0 / 0.24)',
|
|
65
|
-
28: 'oklch(100% 0 0 / 0.28)',
|
|
66
|
-
32: 'oklch(100% 0 0 / 0.32)',
|
|
67
|
-
36: 'oklch(100% 0 0 / 0.36)',
|
|
68
|
-
40: 'oklch(100% 0 0 / 0.4)',
|
|
69
|
-
44: 'oklch(100% 0 0 / 0.44)',
|
|
70
|
-
48: 'oklch(100% 0 0 / 0.48)',
|
|
71
|
-
52: 'oklch(100% 0 0 / 0.52)',
|
|
72
|
-
56: 'oklch(100% 0 0 / 0.56)',
|
|
73
|
-
60: 'oklch(100% 0 0 / 0.6)',
|
|
74
|
-
64: 'oklch(100% 0 0 / 0.64)',
|
|
75
|
-
68: 'oklch(100% 0 0 / 0.68)',
|
|
76
|
-
72: 'oklch(100% 0 0 / 0.72)',
|
|
77
|
-
76: 'oklch(100% 0 0 / 0.76)',
|
|
78
|
-
80: 'oklch(100% 0 0 / 0.8)',
|
|
79
|
-
84: 'oklch(100% 0 0 / 0.84)',
|
|
80
|
-
88: 'oklch(100% 0 0 / 0.88)',
|
|
81
|
-
92: 'oklch(100% 0 0 / 0.92)',
|
|
82
|
-
96: 'oklch(100% 0 0 / 0.96)',
|
|
83
|
-
100: 'oklch(100% 0 0 / 1)',
|
|
84
|
-
};
|
|
85
|
-
exports.blackAlpha = {
|
|
86
|
-
4: 'oklch(0% 0 0 / 0.04)',
|
|
87
|
-
6: 'oklch(0% 0 0 / 0.06)',
|
|
88
|
-
8: 'oklch(0% 0 0 / 0.08)',
|
|
89
|
-
12: 'oklch(0% 0 0 / 0.12)',
|
|
90
|
-
16: 'oklch(0% 0 0 / 0.16)',
|
|
91
|
-
20: 'oklch(0% 0 0 / 0.2)',
|
|
92
|
-
24: 'oklch(0% 0 0 / 0.24)',
|
|
93
|
-
28: 'oklch(0% 0 0 / 0.28)',
|
|
94
|
-
32: 'oklch(0% 0 0 / 0.32)',
|
|
95
|
-
36: 'oklch(0% 0 0 / 0.36)',
|
|
96
|
-
40: 'oklch(0% 0 0 / 0.4)',
|
|
97
|
-
44: 'oklch(0% 0 0 / 0.44)',
|
|
98
|
-
48: 'oklch(0% 0 0 / 0.48)',
|
|
99
|
-
52: 'oklch(0% 0 0 / 0.52)',
|
|
100
|
-
56: 'oklch(0% 0 0 / 0.56)',
|
|
101
|
-
60: 'oklch(0% 0 0 / 0.6)',
|
|
102
|
-
64: 'oklch(0% 0 0 / 0.64)',
|
|
103
|
-
68: 'oklch(0% 0 0 / 0.68)',
|
|
104
|
-
72: 'oklch(0% 0 0 / 0.72)',
|
|
105
|
-
76: 'oklch(0% 0 0 / 0.76)',
|
|
106
|
-
80: 'oklch(0% 0 0 / 0.8)',
|
|
107
|
-
84: 'oklch(0% 0 0 / 0.84)',
|
|
108
|
-
88: 'oklch(0% 0 0 / 0.88)',
|
|
109
|
-
92: 'oklch(0% 0 0 / 0.92)',
|
|
110
|
-
96: 'oklch(0% 0 0 / 0.96)',
|
|
111
|
-
100: 'oklch(0% 0 0 / 1)',
|
|
112
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.PRESSED_DARK_C =
|
|
4
|
-
exports.PRESSED_DARK_L =
|
|
5
|
-
exports.PRESSED_LIGHT_C =
|
|
6
|
-
exports.PRESSED_LIGHT_L =
|
|
7
|
-
exports.HOVER_DARK_C =
|
|
8
|
-
exports.HOVER_DARK_L =
|
|
9
|
-
exports.HOVER_LIGHT_C =
|
|
10
|
-
exports.HOVER_LIGHT_L =
|
|
11
|
-
void 0;
|
|
12
|
-
exports.HOVER_LIGHT_L = -4;
|
|
13
|
-
exports.HOVER_LIGHT_C = 0;
|
|
14
|
-
exports.HOVER_DARK_L = +4;
|
|
15
|
-
exports.HOVER_DARK_C = 0;
|
|
16
|
-
exports.PRESSED_LIGHT_L = -8;
|
|
17
|
-
exports.PRESSED_LIGHT_C = -0.03;
|
|
18
|
-
exports.PRESSED_DARK_L = -4;
|
|
19
|
-
exports.PRESSED_DARK_C = -0.03;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const MIN_LOGO_LIGHTNESS = 64;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.PROMO_HUE_SHIFTS = void 0;
|
|
4
|
-
exports.PROMO_HUE_SHIFTS = {
|
|
5
|
-
0: -24,
|
|
6
|
-
25: -32,
|
|
7
|
-
44: -35,
|
|
8
|
-
148: 40,
|
|
9
|
-
177: 51,
|
|
10
|
-
253: 11,
|
|
11
|
-
264: 14,
|
|
12
|
-
294: 0,
|
|
13
|
-
319: -24,
|
|
14
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.WARNING_HUE_PATCH = void 0;
|
|
4
|
-
exports.WARNING_HUE_PATCH = {
|
|
5
|
-
96: 0,
|
|
6
|
-
92: 0,
|
|
7
|
-
88: 0,
|
|
8
|
-
84: 0,
|
|
9
|
-
80: 0,
|
|
10
|
-
76: 0,
|
|
11
|
-
72: -4,
|
|
12
|
-
68: -8,
|
|
13
|
-
64: -12,
|
|
14
|
-
60: -8,
|
|
15
|
-
56: -4,
|
|
16
|
-
52: -2,
|
|
17
|
-
48: 0,
|
|
18
|
-
44: 0,
|
|
19
|
-
40: 0,
|
|
20
|
-
36: 0,
|
|
21
|
-
32: 0,
|
|
22
|
-
28: 0,
|
|
23
|
-
24: 0,
|
|
24
|
-
20: 0,
|
|
25
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as DEFAULT_SWATCH from './constants/default-swatch';
|
|
2
|
-
import type { BaseTokens } from './types/base-tokens';
|
|
3
|
-
type PresetOrCustom<T extends string> = T | (string & Record<never, never>);
|
|
4
|
-
export declare const ACCENT_PARAMS: string[];
|
|
5
|
-
export interface ColorObject {
|
|
6
|
-
[key: string]: ColorValue;
|
|
7
|
-
}
|
|
8
|
-
export type ColorValue = string | ColorObject | ColorValue[];
|
|
9
|
-
type ColorStructure = ColorObject | ColorValue[];
|
|
10
|
-
export type ColorFormat = 'hex/rgba' | 'rgb/rgba' | 'oklch' | 'hex-aarrggbb';
|
|
11
|
-
export interface ConfigOptions {
|
|
12
|
-
brand: PresetOrCustom<keyof typeof DEFAULT_SWATCH.brand>;
|
|
13
|
-
accent: PresetOrCustom<(typeof ACCENT_PARAMS)[number]>;
|
|
14
|
-
system?: typeof DEFAULT_SWATCH.system;
|
|
15
|
-
format?: ColorFormat;
|
|
16
|
-
}
|
|
17
|
-
export declare function getBaseTokens({ brand, accent, system }: ConfigOptions): BaseTokens;
|
|
18
|
-
export declare function convertOklchToHex(obj: ColorStructure): ColorStructure;
|
|
19
|
-
export declare const convertOklchToRgba: (oklchString: string) => string;
|
|
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;
|
|
26
|
-
export {};
|
|
@@ -1,319 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var __createBinding =
|
|
3
|
-
(this && this.__createBinding) ||
|
|
4
|
-
(Object.create
|
|
5
|
-
? function (o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
-
if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
-
desc = {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function () {
|
|
12
|
-
return m[k];
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
Object.defineProperty(o, k2, desc);
|
|
17
|
-
}
|
|
18
|
-
: function (o, m, k, k2) {
|
|
19
|
-
if (k2 === undefined) k2 = k;
|
|
20
|
-
o[k2] = m[k];
|
|
21
|
-
});
|
|
22
|
-
var __setModuleDefault =
|
|
23
|
-
(this && this.__setModuleDefault) ||
|
|
24
|
-
(Object.create
|
|
25
|
-
? function (o, v) {
|
|
26
|
-
Object.defineProperty(o, 'default', { enumerable: true, value: v });
|
|
27
|
-
}
|
|
28
|
-
: function (o, v) {
|
|
29
|
-
o['default'] = v;
|
|
30
|
-
});
|
|
31
|
-
var __importStar =
|
|
32
|
-
(this && this.__importStar) ||
|
|
33
|
-
function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null)
|
|
37
|
-
for (var k in mod)
|
|
38
|
-
if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
39
|
-
__setModuleDefault(result, mod);
|
|
40
|
-
return result;
|
|
41
|
-
};
|
|
42
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
43
|
-
exports.convertColorFormat =
|
|
44
|
-
exports.convertToAarrggbbRecursive =
|
|
45
|
-
exports.convertToAarrggbb =
|
|
46
|
-
exports.convertHexValuesToRgb =
|
|
47
|
-
exports.convertHexToRgbString =
|
|
48
|
-
exports.convertAlphaOklchToRgba =
|
|
49
|
-
exports.convertOklchToRgba =
|
|
50
|
-
exports.convertOklchToHex =
|
|
51
|
-
exports.getBaseTokens =
|
|
52
|
-
exports.ACCENT_PARAMS =
|
|
53
|
-
void 0;
|
|
54
|
-
var culori_1 = require('culori');
|
|
55
|
-
var get_palette_1 = require('./helpers/get-palette');
|
|
56
|
-
var get_promo_1 = require('./helpers/get-promo');
|
|
57
|
-
var DEFAULT_SWATCH = __importStar(require('./constants/default-swatch'));
|
|
58
|
-
var get_logo_1 = require('./helpers/get-logo');
|
|
59
|
-
var get_interactions_1 = require('./helpers/get-interactions');
|
|
60
|
-
exports.ACCENT_PARAMS = ['brand', 'gray'];
|
|
61
|
-
function getBaseTokens(_a) {
|
|
62
|
-
var brand = _a.brand,
|
|
63
|
-
_b = _a.accent,
|
|
64
|
-
accent = _b === void 0 ? 'gray' : _b,
|
|
65
|
-
_c = _a.system,
|
|
66
|
-
system = _c === void 0 ? DEFAULT_SWATCH.system : _c;
|
|
67
|
-
var isPresetColor = brand in DEFAULT_SWATCH.brand;
|
|
68
|
-
var brandColor;
|
|
69
|
-
if (isPresetColor) {
|
|
70
|
-
brandColor = DEFAULT_SWATCH.brand[brand];
|
|
71
|
-
} else {
|
|
72
|
-
brandColor = brand;
|
|
73
|
-
}
|
|
74
|
-
var accentColor;
|
|
75
|
-
if (accent === 'brand') {
|
|
76
|
-
accentColor = brandColor;
|
|
77
|
-
} else if (accent !== 'gray') {
|
|
78
|
-
accentColor = accent;
|
|
79
|
-
}
|
|
80
|
-
var brandPalette = (0, get_palette_1.getPalette)({ color: brandColor });
|
|
81
|
-
var accentPalette;
|
|
82
|
-
if (accent === 'brand') {
|
|
83
|
-
accentPalette = brandPalette;
|
|
84
|
-
} else if (accent !== 'gray' && accentColor) {
|
|
85
|
-
accentPalette = (0, get_palette_1.getPalette)({ color: accentColor });
|
|
86
|
-
}
|
|
87
|
-
var customizablePalettes = {};
|
|
88
|
-
for (var colorKey in DEFAULT_SWATCH.customizable) {
|
|
89
|
-
var key = colorKey;
|
|
90
|
-
if (key === brand && isPresetColor) {
|
|
91
|
-
customizablePalettes[key] = brandPalette;
|
|
92
|
-
continue;
|
|
93
|
-
}
|
|
94
|
-
customizablePalettes[key] = (0, get_palette_1.getPalette)({
|
|
95
|
-
color: DEFAULT_SWATCH.customizable[key],
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
brand: {
|
|
100
|
-
logo: (0, get_logo_1.getLogo)(brandColor),
|
|
101
|
-
promo: (0, get_promo_1.getPromo)(brandColor),
|
|
102
|
-
original: brandColor,
|
|
103
|
-
interactions: {
|
|
104
|
-
hover: (0, get_interactions_1.getHover)(brandColor),
|
|
105
|
-
pressed: (0, get_interactions_1.getPressed)(brandColor),
|
|
106
|
-
},
|
|
107
|
-
palette: brandPalette,
|
|
108
|
-
},
|
|
109
|
-
accent: accentColor
|
|
110
|
-
? {
|
|
111
|
-
original: {
|
|
112
|
-
light: accentColor,
|
|
113
|
-
dark: accentColor,
|
|
114
|
-
},
|
|
115
|
-
interactions: {
|
|
116
|
-
hover: (0, get_interactions_1.getHover)(accentColor),
|
|
117
|
-
pressed: (0, get_interactions_1.getPressed)(accentColor),
|
|
118
|
-
},
|
|
119
|
-
palette: accentPalette,
|
|
120
|
-
}
|
|
121
|
-
: undefined,
|
|
122
|
-
warning: (0, get_palette_1.getPalette)({ color: system.warning }),
|
|
123
|
-
error: (0, get_palette_1.getPalette)({ color: system.error }),
|
|
124
|
-
success: (0, get_palette_1.getPalette)({ color: system.success }),
|
|
125
|
-
gray: DEFAULT_SWATCH.gray,
|
|
126
|
-
whiteAlpha: DEFAULT_SWATCH.whiteAlpha,
|
|
127
|
-
blackAlpha: DEFAULT_SWATCH.blackAlpha,
|
|
128
|
-
onBrand: (0, get_palette_1.calcOnBrand)(brandColor),
|
|
129
|
-
onAccent: accentColor ? (0, get_palette_1.calcOnBrand)(accentColor) : undefined,
|
|
130
|
-
customizable: customizablePalettes,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
exports.getBaseTokens = getBaseTokens;
|
|
134
|
-
function convertOklchToHex(obj) {
|
|
135
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
136
|
-
return obj;
|
|
137
|
-
}
|
|
138
|
-
if (Array.isArray(obj)) {
|
|
139
|
-
return obj.map(function (item) {
|
|
140
|
-
if (typeof item === 'object' && item !== null) {
|
|
141
|
-
return convertOklchToHex(item);
|
|
142
|
-
}
|
|
143
|
-
return item;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
var newObj = {};
|
|
147
|
-
for (var key in obj) {
|
|
148
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
149
|
-
var value = obj[key];
|
|
150
|
-
if (typeof value === 'string' && value.startsWith('oklch(') && !value.includes('/')) {
|
|
151
|
-
var oklchColor = (0, culori_1.converter)('oklch')(value);
|
|
152
|
-
var rgbColor = (0, culori_1.converter)('rgb')(oklchColor);
|
|
153
|
-
value = (0, culori_1.formatHex)(rgbColor);
|
|
154
|
-
}
|
|
155
|
-
if (typeof value === 'object' && value !== null) {
|
|
156
|
-
newObj[key] = convertOklchToHex(value);
|
|
157
|
-
} else {
|
|
158
|
-
newObj[key] = value;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return newObj;
|
|
163
|
-
}
|
|
164
|
-
exports.convertOklchToHex = convertOklchToHex;
|
|
165
|
-
var convertOklchToRgba = function (oklchString) {
|
|
166
|
-
var _a;
|
|
167
|
-
var oklch = (0, culori_1.converter)('oklch')(oklchString);
|
|
168
|
-
var rgb = (0, culori_1.converter)('rgb')(oklch);
|
|
169
|
-
var r = Math.round(rgb.r * 255);
|
|
170
|
-
var g = Math.round(rgb.g * 255);
|
|
171
|
-
var b = Math.round(rgb.b * 255);
|
|
172
|
-
var alpha = (_a = oklch.alpha) !== null && _a !== void 0 ? _a : 1;
|
|
173
|
-
return 'rgba('.concat(r, ', ').concat(g, ', ').concat(b, ', ').concat(alpha, ')');
|
|
174
|
-
};
|
|
175
|
-
exports.convertOklchToRgba = convertOklchToRgba;
|
|
176
|
-
function convertAlphaOklchToRgba(obj) {
|
|
177
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
178
|
-
return obj;
|
|
179
|
-
}
|
|
180
|
-
if (Array.isArray(obj)) {
|
|
181
|
-
return obj.map(function (item) {
|
|
182
|
-
if (typeof item === 'object' && item !== null) {
|
|
183
|
-
return convertAlphaOklchToRgba(item);
|
|
184
|
-
}
|
|
185
|
-
return item;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
var newObj = {};
|
|
189
|
-
for (var key in obj) {
|
|
190
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
191
|
-
var value = obj[key];
|
|
192
|
-
// Конвертируем OKLCH с альфа-каналом (содержит '/') в RGBA
|
|
193
|
-
if (typeof value === 'string' && value.includes('oklch(')) {
|
|
194
|
-
value = (0, exports.convertOklchToRgba)(value);
|
|
195
|
-
}
|
|
196
|
-
if (typeof value === 'object' && value !== null) {
|
|
197
|
-
newObj[key] = convertAlphaOklchToRgba(value);
|
|
198
|
-
} else {
|
|
199
|
-
newObj[key] = value;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return newObj;
|
|
204
|
-
}
|
|
205
|
-
exports.convertAlphaOklchToRgba = convertAlphaOklchToRgba;
|
|
206
|
-
var convertHexToRgbString = function (hexString) {
|
|
207
|
-
var _a;
|
|
208
|
-
var color = (0, culori_1.converter)('rgb')(hexString);
|
|
209
|
-
if (!color) {
|
|
210
|
-
return hexString;
|
|
211
|
-
}
|
|
212
|
-
var r = Math.round(color.r * 255);
|
|
213
|
-
var g = Math.round(color.g * 255);
|
|
214
|
-
var b = Math.round(color.b * 255);
|
|
215
|
-
var alpha = (_a = color.alpha) !== null && _a !== void 0 ? _a : 1;
|
|
216
|
-
return alpha === 1
|
|
217
|
-
? 'rgb('.concat(r, ', ').concat(g, ', ').concat(b, ')')
|
|
218
|
-
: 'rgba('.concat(r, ', ').concat(g, ', ').concat(b, ', ').concat(alpha, ')');
|
|
219
|
-
};
|
|
220
|
-
exports.convertHexToRgbString = convertHexToRgbString;
|
|
221
|
-
function convertHexValuesToRgb(obj) {
|
|
222
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
223
|
-
return obj;
|
|
224
|
-
}
|
|
225
|
-
if (Array.isArray(obj)) {
|
|
226
|
-
return obj.map(function (item) {
|
|
227
|
-
if (typeof item === 'object' && item !== null) {
|
|
228
|
-
return convertHexValuesToRgb(item);
|
|
229
|
-
}
|
|
230
|
-
return item;
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
var newObj = {};
|
|
234
|
-
for (var key in obj) {
|
|
235
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
236
|
-
var value = obj[key];
|
|
237
|
-
// Конвертируем HEX-строки в RGB(A)-строки
|
|
238
|
-
if (typeof value === 'string' && value.startsWith('#')) {
|
|
239
|
-
newObj[key] = (0, exports.convertHexToRgbString)(value);
|
|
240
|
-
} else if (typeof value === 'object' && value !== null) {
|
|
241
|
-
newObj[key] = convertHexValuesToRgb(value);
|
|
242
|
-
} else {
|
|
243
|
-
newObj[key] = value;
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
return newObj;
|
|
248
|
-
}
|
|
249
|
-
exports.convertHexValuesToRgb = convertHexValuesToRgb;
|
|
250
|
-
var convertToAarrggbb = function (colorString) {
|
|
251
|
-
var _a;
|
|
252
|
-
var color = (0, culori_1.converter)('rgb')(colorString);
|
|
253
|
-
if (!color) {
|
|
254
|
-
return colorString;
|
|
255
|
-
}
|
|
256
|
-
var r = Math.round(color.r * 255);
|
|
257
|
-
var g = Math.round(color.g * 255);
|
|
258
|
-
var b = Math.round(color.b * 255);
|
|
259
|
-
var alpha = Math.round(((_a = color.alpha) !== null && _a !== void 0 ? _a : 1) * 255);
|
|
260
|
-
var toHex = function (c) {
|
|
261
|
-
return c.toString(16).padStart(2, '0');
|
|
262
|
-
};
|
|
263
|
-
var rgbHex = ''.concat(toHex(r)).concat(toHex(g)).concat(toHex(b)).toUpperCase();
|
|
264
|
-
if (alpha === 255) {
|
|
265
|
-
return '#'.concat(rgbHex);
|
|
266
|
-
}
|
|
267
|
-
return '#'.concat(toHex(alpha)).concat(rgbHex).toUpperCase();
|
|
268
|
-
};
|
|
269
|
-
exports.convertToAarrggbb = convertToAarrggbb;
|
|
270
|
-
function convertToAarrggbbRecursive(obj) {
|
|
271
|
-
if (typeof obj !== 'object' || obj === null) {
|
|
272
|
-
return obj;
|
|
273
|
-
}
|
|
274
|
-
if (Array.isArray(obj)) {
|
|
275
|
-
return obj.map(function (item) {
|
|
276
|
-
if (typeof item === 'object' && item !== null) {
|
|
277
|
-
return convertToAarrggbbRecursive(item);
|
|
278
|
-
}
|
|
279
|
-
return item;
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
var newObj = {};
|
|
283
|
-
for (var key in obj) {
|
|
284
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
285
|
-
var value = obj[key];
|
|
286
|
-
// Конвертируем строки цветов (HEX, RGBA) в AARRGGBB
|
|
287
|
-
if (typeof value === 'string') {
|
|
288
|
-
newObj[key] = (0, exports.convertToAarrggbb)(value); // Измененная логика в этой функции
|
|
289
|
-
} else if (typeof value === 'object' && value !== null) {
|
|
290
|
-
newObj[key] = convertToAarrggbbRecursive(value);
|
|
291
|
-
} else {
|
|
292
|
-
newObj[key] = value;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return newObj;
|
|
297
|
-
}
|
|
298
|
-
exports.convertToAarrggbbRecursive = convertToAarrggbbRecursive;
|
|
299
|
-
function convertColorFormat(obj, format) {
|
|
300
|
-
if (format === void 0) {
|
|
301
|
-
format = 'hex/rgba';
|
|
302
|
-
}
|
|
303
|
-
var result = obj;
|
|
304
|
-
result = convertOklchToHex(obj);
|
|
305
|
-
result = convertAlphaOklchToRgba(result);
|
|
306
|
-
switch (format) {
|
|
307
|
-
case 'oklch':
|
|
308
|
-
return obj;
|
|
309
|
-
case 'hex/rgba':
|
|
310
|
-
return result;
|
|
311
|
-
case 'rgb/rgba':
|
|
312
|
-
return convertHexValuesToRgb(result);
|
|
313
|
-
case 'hex-aarrggbb':
|
|
314
|
-
return convertToAarrggbbRecursive(result);
|
|
315
|
-
default:
|
|
316
|
-
return result;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
exports.convertColorFormat = convertColorFormat;
|
package/dist/cjs/get-colors.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type ConfigOptions, type ColorFormat } from './get-base-tokens';
|
|
2
|
-
import { getDefaultTokens } from './get-default-tokens';
|
|
3
|
-
import type { BaseTokens } from './types/base-tokens';
|
|
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'];
|
|
10
|
-
export interface SemanticConfigOptions<T> extends ConfigOptions {
|
|
11
|
-
theme?: 'light' | 'dark';
|
|
12
|
-
overrides?: (base: BaseTokens, defaults?: DefaultTokensFull, params?: SemanticConfigOptions<T>) => Themed<T>;
|
|
13
|
-
format?: ColorFormat;
|
|
14
|
-
}
|
|
15
|
-
export declare function getColors(params: SemanticConfigOptions<DefaultTokens>): DefaultTokens;
|
|
16
|
-
export declare function getColors<T>(
|
|
17
|
-
params: SemanticConfigOptions<T> & {
|
|
18
|
-
overrides: (base: BaseTokens) => Themed<T>;
|
|
19
|
-
}
|
|
20
|
-
): Themed<T>;
|
package/dist/cjs/get-colors.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
-
exports.getColors = void 0;
|
|
4
|
-
var get_base_tokens_1 = require('./get-base-tokens');
|
|
5
|
-
var get_default_tokens_1 = require('./get-default-tokens');
|
|
6
|
-
var DEFAULT_THEME = 'light';
|
|
7
|
-
function getColors(params) {
|
|
8
|
-
var theme = params.theme || DEFAULT_THEME;
|
|
9
|
-
var base = (0, get_base_tokens_1.getBaseTokens)(params);
|
|
10
|
-
var defaults = (0, get_default_tokens_1.getDefaultTokens)(base);
|
|
11
|
-
var result;
|
|
12
|
-
if (params.overrides) {
|
|
13
|
-
result = params.overrides(base, defaults, params)[theme];
|
|
14
|
-
} else {
|
|
15
|
-
result = defaults[theme];
|
|
16
|
-
}
|
|
17
|
-
var finalResult = (0, get_base_tokens_1.convertColorFormat)(result, params.format);
|
|
18
|
-
return finalResult;
|
|
19
|
-
}
|
|
20
|
-
exports.getColors = getColors;
|