@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.
Files changed (111) hide show
  1. package/dist/cjs/constants/abney-correction.js +1102 -1102
  2. package/dist/cjs/constants/chroma-settings.js +102 -102
  3. package/dist/cjs/constants/default-swatch.d.ts +97 -95
  4. package/dist/cjs/constants/default-swatch.js +99 -97
  5. package/dist/cjs/constants/interaction-settings.d.ts +8 -0
  6. package/dist/cjs/constants/interaction-settings.js +19 -0
  7. package/dist/cjs/constants/logo-lightness.js +2 -2
  8. package/dist/cjs/constants/promo-hue-shift.d.ts +1 -1
  9. package/dist/cjs/constants/promo-hue-shift.js +11 -11
  10. package/dist/cjs/constants/warning-hue-patch.d.ts +1 -1
  11. package/dist/cjs/constants/warning-hue-patch.js +22 -22
  12. package/dist/cjs/get-base-tokens.d.ts +11 -9
  13. package/dist/cjs/get-base-tokens.js +178 -202
  14. package/dist/cjs/get-colors.d.ts +19 -0
  15. package/dist/cjs/get-colors.js +16 -0
  16. package/dist/cjs/get-default-tokens.d.ts +642 -1275
  17. package/dist/cjs/get-default-tokens.js +993 -1280
  18. package/dist/cjs/helpers/get-interactions.d.ts +7 -0
  19. package/dist/cjs/helpers/get-interactions.js +61 -0
  20. package/dist/cjs/helpers/get-logo.d.ts +2 -2
  21. package/dist/cjs/helpers/get-logo.js +28 -25
  22. package/dist/cjs/helpers/get-palette.d.ts +69 -42
  23. package/dist/cjs/helpers/get-palette.js +249 -204
  24. package/dist/cjs/helpers/get-promo.d.ts +10 -4
  25. package/dist/cjs/helpers/get-promo.js +48 -50
  26. package/dist/cjs/types/base-tokens.d.ts +115 -43
  27. package/dist/cjs/types/base-tokens.js +2 -2
  28. package/dist/cjs/types/generator-tokens.d.ts +30 -30
  29. package/dist/cjs/types/generator-tokens.js +2 -2
  30. package/dist/cjs/utils/format-variable.d.ts +2 -0
  31. package/dist/cjs/utils/format-variable.js +15 -0
  32. package/dist/colors.default-dark.js +325 -0
  33. package/dist/colors.default-light.js +326 -0
  34. package/dist/colors.js +319 -0
  35. package/dist/colors.less +319 -0
  36. package/dist/colors.scss +319 -0
  37. package/dist/esm/constants/abney-correction.js +1100 -1100
  38. package/dist/esm/constants/chroma-settings.js +100 -100
  39. package/dist/esm/constants/default-swatch.d.ts +97 -95
  40. package/dist/esm/constants/default-swatch.js +97 -95
  41. package/dist/esm/constants/interaction-settings.d.ts +8 -0
  42. package/dist/esm/constants/interaction-settings.js +8 -0
  43. package/dist/esm/constants/promo-hue-shift.d.ts +1 -1
  44. package/dist/esm/constants/promo-hue-shift.js +9 -9
  45. package/dist/esm/constants/warning-hue-patch.d.ts +1 -1
  46. package/dist/esm/constants/warning-hue-patch.js +20 -20
  47. package/dist/esm/get-base-tokens.d.ts +11 -9
  48. package/dist/esm/get-base-tokens.js +130 -172
  49. package/dist/esm/get-colors.d.ts +19 -0
  50. package/dist/esm/get-colors.js +12 -0
  51. package/dist/esm/get-default-tokens.d.ts +642 -1275
  52. package/dist/esm/get-default-tokens.js +991 -1278
  53. package/dist/esm/helpers/get-interactions.d.ts +7 -0
  54. package/dist/esm/helpers/get-interactions.js +49 -0
  55. package/dist/esm/helpers/get-logo.d.ts +2 -2
  56. package/dist/esm/helpers/get-logo.js +24 -21
  57. package/dist/esm/helpers/get-palette.d.ts +69 -42
  58. package/dist/esm/helpers/get-palette.js +197 -175
  59. package/dist/esm/helpers/get-promo.d.ts +10 -4
  60. package/dist/esm/helpers/get-promo.js +44 -46
  61. package/dist/esm/types/base-tokens.d.ts +115 -43
  62. package/dist/esm/types/generator-tokens.d.ts +30 -30
  63. package/dist/esm/utils/format-variable.d.ts +2 -0
  64. package/dist/esm/utils/format-variable.js +10 -0
  65. package/dist/tokens/brand-blue-deep_accent-brand.css +643 -0
  66. package/dist/tokens/brand-blue-deep_accent-gray.css +643 -0
  67. package/dist/tokens/brand-blue_accent-brand.css +643 -0
  68. package/dist/tokens/brand-blue_accent-gray.css +643 -0
  69. package/dist/tokens/brand-green_accent-brand.css +643 -0
  70. package/dist/tokens/brand-green_accent-gray.css +643 -0
  71. package/dist/tokens/brand-mint_accent-brand.css +643 -0
  72. package/dist/tokens/brand-mint_accent-gray.css +643 -0
  73. package/dist/tokens/brand-orange_accent-gray.css +643 -0
  74. package/dist/tokens/brand-purple_accent-brand.css +643 -0
  75. package/dist/tokens/brand-purple_accent-gray.css +643 -0
  76. package/dist/tokens/brand-red_accent-gray.css +643 -0
  77. package/dist/tokens/brand-violet_accent-brand.css +643 -0
  78. package/dist/tokens/brand-violet_accent-gray.css +643 -0
  79. package/dist/tokens-js/brand-blue-deep_accent-brand.js +644 -0
  80. package/dist/tokens-js/brand-blue-deep_accent-gray.js +644 -0
  81. package/dist/tokens-js/brand-blue_accent-brand.js +644 -0
  82. package/dist/tokens-js/brand-blue_accent-gray.js +644 -0
  83. package/dist/tokens-js/brand-green_accent-brand.js +644 -0
  84. package/dist/tokens-js/brand-green_accent-gray.js +644 -0
  85. package/dist/tokens-js/brand-mint_accent-brand.js +644 -0
  86. package/dist/tokens-js/brand-mint_accent-gray.js +644 -0
  87. package/dist/tokens-js/brand-orange_accent-gray.js +644 -0
  88. package/dist/tokens-js/brand-purple_accent-brand.js +644 -0
  89. package/dist/tokens-js/brand-purple_accent-gray.js +644 -0
  90. package/dist/tokens-js/brand-red_accent-gray.js +644 -0
  91. package/dist/tokens-js/brand-violet_accent-brand.js +644 -0
  92. package/dist/tokens-js/brand-violet_accent-gray.js +644 -0
  93. package/dist/tokens-mobile/brand-blue-deep_accent-brand.json +718 -0
  94. package/dist/tokens-mobile/brand-blue-deep_accent-gray.json +718 -0
  95. package/dist/tokens-mobile/brand-blue_accent-brand.json +718 -0
  96. package/dist/tokens-mobile/brand-blue_accent-gray.json +718 -0
  97. package/dist/tokens-mobile/brand-green_accent-brand.json +718 -0
  98. package/dist/tokens-mobile/brand-green_accent-gray.json +718 -0
  99. package/dist/tokens-mobile/brand-mint_accent-brand.json +718 -0
  100. package/dist/tokens-mobile/brand-mint_accent-gray.json +718 -0
  101. package/dist/tokens-mobile/brand-orange_accent-gray.json +718 -0
  102. package/dist/tokens-mobile/brand-purple_accent-brand.json +718 -0
  103. package/dist/tokens-mobile/brand-purple_accent-gray.json +718 -0
  104. package/dist/tokens-mobile/brand-red_accent-gray.json +718 -0
  105. package/dist/tokens-mobile/brand-violet_accent-brand.json +718 -0
  106. package/dist/tokens-mobile/brand-violet_accent-gray.json +718 -0
  107. package/package.json +7 -6
  108. package/dist/cjs/get-tokens.d.ts +0 -15
  109. package/dist/cjs/get-tokens.js +0 -13
  110. package/dist/esm/get-tokens.d.ts +0 -15
  111. package/dist/esm/get-tokens.js +0 -9
@@ -0,0 +1,7 @@
1
+ interface InteractionColors {
2
+ light: string;
3
+ dark: string;
4
+ }
5
+ export declare function getHover(hex: string): InteractionColors;
6
+ export declare function getPressed(hex: string): InteractionColors;
7
+ export {};
@@ -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,6 +1,6 @@
1
1
  interface LogoColors {
2
- light: string;
3
- dark: string;
2
+ light: string;
3
+ dark: string;
4
4
  }
5
5
  export declare function getLogo(hex: string): LogoColors;
6
6
  export {};
@@ -1,29 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.getLogo = void 0;
4
- var culori_1 = require("culori");
5
- var logo_lightness_1 = require("../constants/logo-lightness");
4
+ var culori_1 = require('culori');
5
+ var logo_lightness_1 = require('../constants/logo-lightness');
6
6
  function getLogo(hex) {
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, l = _a === void 0 ? 0 : _a, _b = oklchColor.c, c = _b === void 0 ? 0 : _b;
15
- var h = oklchColor.h;
16
- var safeH = h === undefined || isNaN(h) ? 0 : h;
17
- l = l || 0;
18
- c = c || 0;
19
- var percentL = l * 100;
20
- if (percentL < logo_lightness_1.MIN_LOGO_LIGHTNESS) {
21
- l = logo_lightness_1.MIN_LOGO_LIGHTNESS / 100;
22
- }
23
- var darkThemeLogoColor = "oklch(".concat(l.toFixed(3), " ").concat(c.toFixed(3), " ").concat(safeH.toFixed(0), ")");
24
- return {
25
- light: lightThemeLogoColor,
26
- dark: darkThemeLogoColor,
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 { GeneratorColorAbneyCorrection, GeneratorColorChromaSettingsGroup, GeneratorColorPalette, GeneratorColorWarningHuePatch } from '../types/generator-tokens';
1
+ import type {
2
+ GeneratorColorAbneyCorrection,
3
+ GeneratorColorChromaSettingsGroup,
4
+ GeneratorColorPalette,
5
+ GeneratorColorWarningHuePatch,
6
+ } from '../types/generator-tokens';
2
7
  interface GeneratePaletteParams {
3
- color: string;
4
- type?: 'default' | 'warning';
5
- settings?: {
6
- chromaSettings?: GeneratorColorChromaSettingsGroup;
7
- abneyCorrection?: GeneratorColorAbneyCorrection;
8
- promoHueShifts?: {
9
- [hueRange: number]: number;
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({ color, type, settings: customSettings, }: GeneratePaletteParams): GeneratorColorPalette;
15
- export declare function getAbneyHueShift(lightness: number, currentHue: number, abneyData: GeneratorColorAbneyCorrection): number;
16
- export declare function applyAbneyShift(lightness: number, currentHue: number, abneyData: GeneratorColorAbneyCorrection): number;
17
- export declare function applyWarningHuePatch(currentHue: number, lightness: number, warningHuePatchData: GeneratorColorWarningHuePatch, isWarningMode: boolean): number;
18
- export declare function calculateBaseHueAndCorrectionRange(inputColorString: string, abneyData: GeneratorColorAbneyCorrection): {
19
- baseHue: number;
20
- correctionLightness: number;
21
- correctionHueRange: number;
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
- 4: string;
25
- 8: string;
26
- 12: string;
27
- 16: string;
28
- 20: string;
29
- 24: string;
30
- 28: string;
31
- 32: string;
32
- 36: string;
33
- 40: string;
34
- 44: string;
35
- 48: string;
36
- 52: string;
37
- 56: string;
38
- 60: string;
39
- 64: string;
40
- 68: string;
41
- 72: string;
42
- 76: string;
43
- 80: string;
44
- 84: string;
45
- 88: string;
46
- 92: string;
47
- 96: string;
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 {};