@skbkontur/colors 1.1.2-d1791.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants/abney-correction.js +1102 -1102
- package/dist/cjs/constants/chroma-settings.js +102 -102
- package/dist/cjs/constants/default-swatch.d.ts +97 -95
- package/dist/cjs/constants/default-swatch.js +99 -97
- package/dist/cjs/constants/interaction-settings.d.ts +8 -0
- package/dist/cjs/constants/interaction-settings.js +19 -0
- package/dist/cjs/constants/logo-lightness.js +2 -2
- package/dist/cjs/constants/promo-hue-shift.d.ts +1 -1
- package/dist/cjs/constants/promo-hue-shift.js +11 -11
- package/dist/cjs/constants/warning-hue-patch.d.ts +1 -1
- package/dist/cjs/constants/warning-hue-patch.js +22 -22
- package/dist/cjs/get-base-tokens.d.ts +11 -9
- package/dist/cjs/get-base-tokens.js +178 -202
- package/dist/cjs/get-colors.d.ts +19 -0
- package/dist/cjs/get-colors.js +16 -0
- package/dist/cjs/get-default-tokens.d.ts +642 -1275
- package/dist/cjs/get-default-tokens.js +993 -1280
- package/dist/cjs/helpers/get-interactions.d.ts +7 -0
- package/dist/cjs/helpers/get-interactions.js +61 -0
- package/dist/cjs/helpers/get-logo.d.ts +2 -2
- package/dist/cjs/helpers/get-logo.js +28 -25
- package/dist/cjs/helpers/get-palette.d.ts +69 -42
- package/dist/cjs/helpers/get-palette.js +249 -204
- package/dist/cjs/helpers/get-promo.d.ts +10 -4
- package/dist/cjs/helpers/get-promo.js +48 -50
- package/dist/cjs/types/base-tokens.d.ts +115 -43
- package/dist/cjs/types/base-tokens.js +2 -2
- package/dist/cjs/types/generator-tokens.d.ts +30 -30
- package/dist/cjs/types/generator-tokens.js +2 -2
- package/dist/cjs/utils/format-variable.d.ts +2 -0
- package/dist/cjs/utils/format-variable.js +15 -0
- package/dist/colors.default-dark.js +325 -0
- package/dist/colors.default-light.js +326 -0
- package/dist/colors.js +319 -0
- package/dist/colors.less +319 -0
- package/dist/colors.scss +319 -0
- package/dist/esm/constants/abney-correction.js +1100 -1100
- package/dist/esm/constants/chroma-settings.js +100 -100
- package/dist/esm/constants/default-swatch.d.ts +97 -95
- package/dist/esm/constants/default-swatch.js +97 -95
- package/dist/esm/constants/interaction-settings.d.ts +8 -0
- package/dist/esm/constants/interaction-settings.js +8 -0
- package/dist/esm/constants/promo-hue-shift.d.ts +1 -1
- package/dist/esm/constants/promo-hue-shift.js +9 -9
- package/dist/esm/constants/warning-hue-patch.d.ts +1 -1
- package/dist/esm/constants/warning-hue-patch.js +20 -20
- package/dist/esm/get-base-tokens.d.ts +11 -9
- package/dist/esm/get-base-tokens.js +130 -172
- package/dist/esm/get-colors.d.ts +19 -0
- package/dist/esm/get-colors.js +12 -0
- package/dist/esm/get-default-tokens.d.ts +642 -1275
- package/dist/esm/get-default-tokens.js +991 -1278
- package/dist/esm/helpers/get-interactions.d.ts +7 -0
- package/dist/esm/helpers/get-interactions.js +49 -0
- package/dist/esm/helpers/get-logo.d.ts +2 -2
- package/dist/esm/helpers/get-logo.js +24 -21
- package/dist/esm/helpers/get-palette.d.ts +69 -42
- package/dist/esm/helpers/get-palette.js +197 -175
- package/dist/esm/helpers/get-promo.d.ts +10 -4
- package/dist/esm/helpers/get-promo.js +44 -46
- package/dist/esm/types/base-tokens.d.ts +115 -43
- package/dist/esm/types/generator-tokens.d.ts +30 -30
- package/dist/esm/utils/format-variable.d.ts +2 -0
- package/dist/esm/utils/format-variable.js +10 -0
- package/dist/tokens/brand-blue-deep_accent-brand.css +643 -0
- package/dist/tokens/brand-blue-deep_accent-gray.css +643 -0
- package/dist/tokens/brand-blue_accent-brand.css +643 -0
- package/dist/tokens/brand-blue_accent-gray.css +643 -0
- package/dist/tokens/brand-green_accent-brand.css +643 -0
- package/dist/tokens/brand-green_accent-gray.css +643 -0
- package/dist/tokens/brand-mint_accent-brand.css +643 -0
- package/dist/tokens/brand-mint_accent-gray.css +643 -0
- package/dist/tokens/brand-orange_accent-gray.css +643 -0
- package/dist/tokens/brand-purple_accent-brand.css +643 -0
- package/dist/tokens/brand-purple_accent-gray.css +643 -0
- package/dist/tokens/brand-red_accent-gray.css +643 -0
- package/dist/tokens/brand-violet_accent-brand.css +643 -0
- package/dist/tokens/brand-violet_accent-gray.css +643 -0
- package/dist/tokens-js/brand-blue-deep_accent-brand.js +644 -0
- package/dist/tokens-js/brand-blue-deep_accent-gray.js +644 -0
- package/dist/tokens-js/brand-blue_accent-brand.js +644 -0
- package/dist/tokens-js/brand-blue_accent-gray.js +644 -0
- package/dist/tokens-js/brand-green_accent-brand.js +644 -0
- package/dist/tokens-js/brand-green_accent-gray.js +644 -0
- package/dist/tokens-js/brand-mint_accent-brand.js +644 -0
- package/dist/tokens-js/brand-mint_accent-gray.js +644 -0
- package/dist/tokens-js/brand-orange_accent-gray.js +644 -0
- package/dist/tokens-js/brand-purple_accent-brand.js +644 -0
- package/dist/tokens-js/brand-purple_accent-gray.js +644 -0
- package/dist/tokens-js/brand-red_accent-gray.js +644 -0
- package/dist/tokens-js/brand-violet_accent-brand.js +644 -0
- package/dist/tokens-js/brand-violet_accent-gray.js +644 -0
- package/dist/tokens-mobile/brand-blue-deep_accent-brand.json +718 -0
- package/dist/tokens-mobile/brand-blue-deep_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-blue_accent-brand.json +718 -0
- package/dist/tokens-mobile/brand-blue_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-green_accent-brand.json +718 -0
- package/dist/tokens-mobile/brand-green_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-mint_accent-brand.json +718 -0
- package/dist/tokens-mobile/brand-mint_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-orange_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-purple_accent-brand.json +718 -0
- package/dist/tokens-mobile/brand-purple_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-red_accent-gray.json +718 -0
- package/dist/tokens-mobile/brand-violet_accent-brand.json +718 -0
- package/dist/tokens-mobile/brand-violet_accent-gray.json +718 -0
- package/package.json +7 -6
- package/dist/cjs/get-tokens.d.ts +0 -15
- package/dist/cjs/get-tokens.js +0 -13
- package/dist/esm/get-tokens.d.ts +0 -15
- package/dist/esm/get-tokens.js +0 -9
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
exports.getPressed = exports.getHover = void 0;
|
|
4
|
+
var culori_1 = require('culori');
|
|
5
|
+
var interaction_settings_1 = require('../constants/interaction-settings');
|
|
6
|
+
function applyOklchDelta(oklchColor, dL, dC) {
|
|
7
|
+
var _a = oklchColor.l,
|
|
8
|
+
l = _a === void 0 ? 0 : _a,
|
|
9
|
+
_b = oklchColor.c,
|
|
10
|
+
c = _b === void 0 ? 0 : _b,
|
|
11
|
+
_c = oklchColor.h,
|
|
12
|
+
h = _c === void 0 ? 0 : _c;
|
|
13
|
+
var safeH = h === undefined || isNaN(h) ? 0 : h;
|
|
14
|
+
var newL = Math.max(0, Math.min(1, l + dL / 100));
|
|
15
|
+
var newC = Math.max(0, c + dC);
|
|
16
|
+
return 'oklch('.concat(newL.toFixed(3), ' ').concat(newC.toFixed(3), ' ').concat(safeH.toFixed(0), ')');
|
|
17
|
+
}
|
|
18
|
+
function getHover(hex) {
|
|
19
|
+
var toOklch = (0, culori_1.converter)('oklch');
|
|
20
|
+
var oklchColor = toOklch(hex);
|
|
21
|
+
if (!oklchColor) {
|
|
22
|
+
return { light: hex, dark: hex };
|
|
23
|
+
}
|
|
24
|
+
var lightHoverColor = applyOklchDelta(
|
|
25
|
+
oklchColor,
|
|
26
|
+
interaction_settings_1.HOVER_LIGHT_L,
|
|
27
|
+
interaction_settings_1.HOVER_LIGHT_C
|
|
28
|
+
);
|
|
29
|
+
var darkHoverColor = applyOklchDelta(
|
|
30
|
+
oklchColor,
|
|
31
|
+
interaction_settings_1.HOVER_DARK_L,
|
|
32
|
+
interaction_settings_1.HOVER_DARK_C
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
light: lightHoverColor,
|
|
36
|
+
dark: darkHoverColor,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
exports.getHover = getHover;
|
|
40
|
+
function getPressed(hex) {
|
|
41
|
+
var toOklch = (0, culori_1.converter)('oklch');
|
|
42
|
+
var oklchColor = toOklch(hex);
|
|
43
|
+
if (!oklchColor) {
|
|
44
|
+
return { light: hex, dark: hex };
|
|
45
|
+
}
|
|
46
|
+
var lightPressedColor = applyOklchDelta(
|
|
47
|
+
oklchColor,
|
|
48
|
+
interaction_settings_1.PRESSED_LIGHT_L,
|
|
49
|
+
interaction_settings_1.PRESSED_LIGHT_C
|
|
50
|
+
);
|
|
51
|
+
var darkPressedColor = applyOklchDelta(
|
|
52
|
+
oklchColor,
|
|
53
|
+
interaction_settings_1.PRESSED_DARK_L,
|
|
54
|
+
interaction_settings_1.PRESSED_DARK_C
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
light: lightPressedColor,
|
|
58
|
+
dark: darkPressedColor,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
exports.getPressed = getPressed;
|
|
@@ -1,29 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
3
|
exports.getLogo = void 0;
|
|
4
|
-
var culori_1 = require(
|
|
5
|
-
var logo_lightness_1 = require(
|
|
4
|
+
var culori_1 = require('culori');
|
|
5
|
+
var logo_lightness_1 = require('../constants/logo-lightness');
|
|
6
6
|
function getLogo(hex) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
7
|
+
var toOklch = (0, culori_1.converter)('oklch');
|
|
8
|
+
var oklchColor = toOklch(hex);
|
|
9
|
+
var lightThemeLogoColor = hex;
|
|
10
|
+
if (!oklchColor) {
|
|
11
|
+
var fallbackColor = 'oklch('.concat(logo_lightness_1.MIN_LOGO_LIGHTNESS, '% 0 0)');
|
|
12
|
+
return { light: hex, dark: fallbackColor };
|
|
13
|
+
}
|
|
14
|
+
var _a = oklchColor.l,
|
|
15
|
+
l = _a === void 0 ? 0 : _a,
|
|
16
|
+
_b = oklchColor.c,
|
|
17
|
+
c = _b === void 0 ? 0 : _b;
|
|
18
|
+
var h = oklchColor.h;
|
|
19
|
+
var safeH = h === undefined || isNaN(h) ? 0 : h;
|
|
20
|
+
l = l || 0;
|
|
21
|
+
c = c || 0;
|
|
22
|
+
var percentL = l * 100;
|
|
23
|
+
if (percentL < logo_lightness_1.MIN_LOGO_LIGHTNESS) {
|
|
24
|
+
l = logo_lightness_1.MIN_LOGO_LIGHTNESS / 100;
|
|
25
|
+
}
|
|
26
|
+
var darkThemeLogoColor = 'oklch('.concat(l.toFixed(3), ' ').concat(c.toFixed(3), ' ').concat(safeH.toFixed(0), ')');
|
|
27
|
+
return {
|
|
28
|
+
light: lightThemeLogoColor,
|
|
29
|
+
dark: darkThemeLogoColor,
|
|
30
|
+
};
|
|
28
31
|
}
|
|
29
32
|
exports.getLogo = getLogo;
|
|
@@ -1,49 +1,76 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
GeneratorColorAbneyCorrection,
|
|
3
|
+
GeneratorColorChromaSettingsGroup,
|
|
4
|
+
GeneratorColorPalette,
|
|
5
|
+
GeneratorColorWarningHuePatch,
|
|
6
|
+
} from '../types/generator-tokens';
|
|
2
7
|
interface GeneratePaletteParams {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
warningHuePatch?: GeneratorColorWarningHuePatch;
|
|
8
|
+
color: string;
|
|
9
|
+
type?: 'default' | 'warning';
|
|
10
|
+
settings?: {
|
|
11
|
+
chromaSettings?: GeneratorColorChromaSettingsGroup;
|
|
12
|
+
abneyCorrection?: GeneratorColorAbneyCorrection;
|
|
13
|
+
promoHueShifts?: {
|
|
14
|
+
[hueRange: number]: number;
|
|
12
15
|
};
|
|
16
|
+
warningHuePatch?: GeneratorColorWarningHuePatch;
|
|
17
|
+
};
|
|
13
18
|
}
|
|
14
|
-
export declare function getPalette({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export declare function getPalette({
|
|
20
|
+
color,
|
|
21
|
+
type,
|
|
22
|
+
settings: customSettings,
|
|
23
|
+
}: GeneratePaletteParams): GeneratorColorPalette;
|
|
24
|
+
export declare function getAbneyHueShift(
|
|
25
|
+
lightness: number,
|
|
26
|
+
currentHue: number,
|
|
27
|
+
abneyData: GeneratorColorAbneyCorrection
|
|
28
|
+
): number;
|
|
29
|
+
export declare function applyAbneyShift(
|
|
30
|
+
lightness: number,
|
|
31
|
+
currentHue: number,
|
|
32
|
+
abneyData: GeneratorColorAbneyCorrection
|
|
33
|
+
): number;
|
|
34
|
+
export declare function applyWarningHuePatch(
|
|
35
|
+
currentHue: number,
|
|
36
|
+
lightness: number,
|
|
37
|
+
warningHuePatchData: GeneratorColorWarningHuePatch,
|
|
38
|
+
isWarningMode: boolean
|
|
39
|
+
): number;
|
|
40
|
+
export declare function calculateBaseHueAndCorrectionRange(
|
|
41
|
+
inputColorString: string,
|
|
42
|
+
abneyData: GeneratorColorAbneyCorrection
|
|
43
|
+
): {
|
|
44
|
+
baseHue: number;
|
|
45
|
+
correctionLightness: number;
|
|
46
|
+
correctionHueRange: number;
|
|
22
47
|
} | null;
|
|
23
48
|
export declare function calcOnBrand(hex: string): {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
49
|
+
4: string;
|
|
50
|
+
6: string;
|
|
51
|
+
8: string;
|
|
52
|
+
12: string;
|
|
53
|
+
16: string;
|
|
54
|
+
20: string;
|
|
55
|
+
24: string;
|
|
56
|
+
28: string;
|
|
57
|
+
32: string;
|
|
58
|
+
36: string;
|
|
59
|
+
40: string;
|
|
60
|
+
44: string;
|
|
61
|
+
48: string;
|
|
62
|
+
52: string;
|
|
63
|
+
56: string;
|
|
64
|
+
60: string;
|
|
65
|
+
64: string;
|
|
66
|
+
68: string;
|
|
67
|
+
72: string;
|
|
68
|
+
76: string;
|
|
69
|
+
80: string;
|
|
70
|
+
84: string;
|
|
71
|
+
88: string;
|
|
72
|
+
92: string;
|
|
73
|
+
96: string;
|
|
74
|
+
100: string;
|
|
48
75
|
};
|
|
49
76
|
export {};
|