@skbkontur/colors 1.1.2-dc095.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 (124) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/constants/abney-correction.d.ts +2 -0
  3. package/dist/cjs/constants/abney-correction.js +1105 -0
  4. package/dist/cjs/constants/chroma-settings.d.ts +2 -0
  5. package/dist/cjs/constants/chroma-settings.js +105 -0
  6. package/dist/cjs/constants/default-swatch.d.ts +109 -0
  7. package/dist/cjs/constants/default-swatch.js +112 -0
  8. package/dist/cjs/constants/interaction-settings.d.ts +8 -0
  9. package/dist/cjs/constants/interaction-settings.js +19 -0
  10. package/dist/cjs/constants/logo-lightness.d.ts +1 -0
  11. package/dist/cjs/constants/logo-lightness.js +4 -0
  12. package/dist/cjs/constants/promo-hue-shift.d.ts +3 -0
  13. package/dist/cjs/constants/promo-hue-shift.js +14 -0
  14. package/dist/cjs/constants/warning-hue-patch.d.ts +3 -0
  15. package/dist/cjs/constants/warning-hue-patch.js +25 -0
  16. package/dist/cjs/get-base-tokens.d.ts +19 -0
  17. package/dist/cjs/get-base-tokens.js +199 -0
  18. package/dist/cjs/get-colors.d.ts +19 -0
  19. package/dist/cjs/get-colors.js +16 -0
  20. package/dist/cjs/get-default-tokens.d.ts +645 -0
  21. package/dist/cjs/get-default-tokens.js +997 -0
  22. package/dist/cjs/helpers/get-interactions.d.ts +7 -0
  23. package/dist/cjs/helpers/get-interactions.js +61 -0
  24. package/dist/cjs/helpers/get-logo.d.ts +6 -0
  25. package/dist/cjs/helpers/get-logo.js +32 -0
  26. package/dist/cjs/helpers/get-palette.d.ts +76 -0
  27. package/dist/cjs/helpers/get-palette.js +287 -0
  28. package/dist/cjs/helpers/get-promo.d.ts +12 -0
  29. package/dist/cjs/helpers/get-promo.js +56 -0
  30. package/dist/cjs/types/base-tokens.d.ts +125 -0
  31. package/dist/cjs/types/base-tokens.js +2 -0
  32. package/dist/cjs/types/generator-tokens.d.ts +43 -0
  33. package/dist/cjs/types/generator-tokens.js +2 -0
  34. package/dist/cjs/utils/format-variable.d.ts +2 -0
  35. package/dist/cjs/utils/format-variable.js +15 -0
  36. package/dist/colors.default-dark.js +325 -0
  37. package/dist/colors.default-light.js +326 -0
  38. package/dist/colors.js +319 -0
  39. package/dist/colors.less +319 -0
  40. package/dist/colors.scss +319 -0
  41. package/dist/esm/constants/abney-correction.d.ts +2 -0
  42. package/dist/esm/constants/abney-correction.js +1102 -0
  43. package/dist/esm/constants/chroma-settings.d.ts +2 -0
  44. package/dist/esm/constants/chroma-settings.js +102 -0
  45. package/dist/esm/constants/default-swatch.d.ts +109 -0
  46. package/dist/esm/constants/default-swatch.js +109 -0
  47. package/dist/esm/constants/interaction-settings.d.ts +8 -0
  48. package/dist/esm/constants/interaction-settings.js +8 -0
  49. package/dist/esm/constants/logo-lightness.d.ts +1 -0
  50. package/dist/esm/constants/logo-lightness.js +1 -0
  51. package/dist/esm/constants/promo-hue-shift.d.ts +3 -0
  52. package/dist/esm/constants/promo-hue-shift.js +11 -0
  53. package/dist/esm/constants/warning-hue-patch.d.ts +3 -0
  54. package/dist/esm/constants/warning-hue-patch.js +22 -0
  55. package/dist/esm/get-base-tokens.d.ts +19 -0
  56. package/dist/esm/get-base-tokens.js +147 -0
  57. package/dist/esm/get-colors.d.ts +19 -0
  58. package/dist/esm/get-colors.js +12 -0
  59. package/dist/esm/get-default-tokens.d.ts +645 -0
  60. package/dist/esm/get-default-tokens.js +993 -0
  61. package/dist/esm/helpers/get-interactions.d.ts +7 -0
  62. package/dist/esm/helpers/get-interactions.js +49 -0
  63. package/dist/esm/helpers/get-logo.d.ts +6 -0
  64. package/dist/esm/helpers/get-logo.js +28 -0
  65. package/dist/esm/helpers/get-palette.d.ts +76 -0
  66. package/dist/esm/helpers/get-palette.js +232 -0
  67. package/dist/esm/helpers/get-promo.d.ts +12 -0
  68. package/dist/esm/helpers/get-promo.js +51 -0
  69. package/dist/esm/types/base-tokens.d.ts +125 -0
  70. package/dist/esm/types/base-tokens.js +1 -0
  71. package/dist/esm/types/generator-tokens.d.ts +43 -0
  72. package/dist/esm/types/generator-tokens.js +1 -0
  73. package/dist/esm/utils/format-variable.d.ts +2 -0
  74. package/dist/esm/utils/format-variable.js +10 -0
  75. package/dist/tokens/brand-blue-deep_accent-brand.css +643 -0
  76. package/dist/tokens/brand-blue-deep_accent-gray.css +643 -0
  77. package/dist/tokens/brand-blue_accent-brand.css +643 -0
  78. package/dist/tokens/brand-blue_accent-gray.css +643 -0
  79. package/dist/tokens/brand-green_accent-brand.css +643 -0
  80. package/dist/tokens/brand-green_accent-gray.css +643 -0
  81. package/dist/tokens/brand-mint_accent-brand.css +643 -0
  82. package/dist/tokens/brand-mint_accent-gray.css +643 -0
  83. package/dist/tokens/brand-orange_accent-gray.css +643 -0
  84. package/dist/tokens/brand-purple_accent-brand.css +643 -0
  85. package/dist/tokens/brand-purple_accent-gray.css +643 -0
  86. package/dist/tokens/brand-red_accent-gray.css +643 -0
  87. package/dist/tokens/brand-violet_accent-brand.css +643 -0
  88. package/dist/tokens/brand-violet_accent-gray.css +643 -0
  89. package/dist/tokens-js/brand-blue-deep_accent-brand.js +644 -0
  90. package/dist/tokens-js/brand-blue-deep_accent-gray.js +644 -0
  91. package/dist/tokens-js/brand-blue_accent-brand.js +644 -0
  92. package/dist/tokens-js/brand-blue_accent-gray.js +644 -0
  93. package/dist/tokens-js/brand-green_accent-brand.js +644 -0
  94. package/dist/tokens-js/brand-green_accent-gray.js +644 -0
  95. package/dist/tokens-js/brand-mint_accent-brand.js +644 -0
  96. package/dist/tokens-js/brand-mint_accent-gray.js +644 -0
  97. package/dist/tokens-js/brand-orange_accent-gray.js +644 -0
  98. package/dist/tokens-js/brand-purple_accent-brand.js +644 -0
  99. package/dist/tokens-js/brand-purple_accent-gray.js +644 -0
  100. package/dist/tokens-js/brand-red_accent-gray.js +644 -0
  101. package/dist/tokens-js/brand-violet_accent-brand.js +644 -0
  102. package/dist/tokens-js/brand-violet_accent-gray.js +644 -0
  103. package/dist/tokens-mobile/brand-blue-deep_accent-brand.json +718 -0
  104. package/dist/tokens-mobile/brand-blue-deep_accent-gray.json +718 -0
  105. package/dist/tokens-mobile/brand-blue_accent-brand.json +718 -0
  106. package/dist/tokens-mobile/brand-blue_accent-gray.json +718 -0
  107. package/dist/tokens-mobile/brand-green_accent-brand.json +718 -0
  108. package/dist/tokens-mobile/brand-green_accent-gray.json +718 -0
  109. package/dist/tokens-mobile/brand-mint_accent-brand.json +718 -0
  110. package/dist/tokens-mobile/brand-mint_accent-gray.json +718 -0
  111. package/dist/tokens-mobile/brand-orange_accent-gray.json +718 -0
  112. package/dist/tokens-mobile/brand-purple_accent-brand.json +718 -0
  113. package/dist/tokens-mobile/brand-purple_accent-gray.json +718 -0
  114. package/dist/tokens-mobile/brand-red_accent-gray.json +718 -0
  115. package/dist/tokens-mobile/brand-violet_accent-brand.json +718 -0
  116. package/dist/tokens-mobile/brand-violet_accent-gray.json +718 -0
  117. package/package.json +13 -7
  118. package/colors.css +0 -160
  119. package/colors.less +0 -158
  120. package/colors.scss +0 -158
  121. package/dist/cjs/colors.d.ts +0 -161
  122. package/dist/cjs/colors.js +0 -163
  123. package/dist/esm/colors.d.ts +0 -161
  124. package/dist/esm/colors.js +0 -163
@@ -0,0 +1,2 @@
1
+ import type { GeneratorColorChromaSettingsGroup } from '../types/generator-tokens';
2
+ export declare const CHROMA_SETTINGS: GeneratorColorChromaSettingsGroup;
@@ -0,0 +1,102 @@
1
+ export var CHROMA_SETTINGS = {
2
+ 20: {
3
+ vivid: { rel: 100, max: 12 },
4
+ normal: { rel: 66, min: 4.4, max: 8 },
5
+ dim: { rel: 46, min: 2, max: 4.4 },
6
+ },
7
+ 24: {
8
+ vivid: { rel: 100, max: 14.2 },
9
+ normal: { rel: 68, min: 5.7, max: 10 },
10
+ dim: { rel: 48, min: 2.8, max: 5.7 },
11
+ },
12
+ 28: {
13
+ vivid: { rel: 100, max: 15.8 },
14
+ normal: { rel: 70, min: 7, max: 11.8 },
15
+ dim: { rel: 50, min: 3.6, max: 7 },
16
+ },
17
+ 32: {
18
+ vivid: { rel: 100, max: 17.1 },
19
+ normal: { rel: 72, min: 8.2, max: 13.2 },
20
+ dim: { rel: 52, min: 4.4, max: 8.2 },
21
+ },
22
+ 36: {
23
+ vivid: { rel: 100, max: 18 },
24
+ normal: { rel: 74, min: 9.4, max: 14.4 },
25
+ dim: { rel: 54, min: 5.2, max: 9.4 },
26
+ },
27
+ 40: {
28
+ vivid: { rel: 100, max: 18.8 },
29
+ normal: { rel: 76, min: 10.6, max: 15.6 },
30
+ dim: { rel: 56, min: 6, max: 10.6 },
31
+ },
32
+ 44: {
33
+ vivid: { rel: 100, max: 19.6 },
34
+ normal: { rel: 78, min: 11.7, max: 16.6 },
35
+ dim: { rel: 58, min: 6.8, max: 11.7 },
36
+ },
37
+ 48: {
38
+ vivid: { rel: 100, max: 20.3 },
39
+ normal: { rel: 80, min: 12.8, max: 17.5 },
40
+ dim: { rel: 60, min: 7.6, max: 12.8 },
41
+ },
42
+ 52: {
43
+ vivid: { rel: 100, max: 21 },
44
+ normal: { rel: 82, min: 13.9, max: 18.4 },
45
+ dim: { rel: 62, min: 8.4, max: 13.9 },
46
+ },
47
+ 56: {
48
+ vivid: { rel: 100, max: 21.6 },
49
+ normal: { rel: 84, min: 15, max: 19.2 },
50
+ dim: { rel: 64, min: 9.2, max: 15 },
51
+ },
52
+ 60: {
53
+ vivid: { rel: 100, max: 22 },
54
+ normal: { rel: 86, min: 15.9, max: 19.9 },
55
+ dim: { rel: 66, min: 9.9, max: 15.9 },
56
+ },
57
+ 64: {
58
+ vivid: { rel: 100, max: 22.2 },
59
+ normal: { rel: 88, min: 16.2, max: 20.2 },
60
+ dim: { rel: 68, min: 10.2, max: 16.2 },
61
+ },
62
+ 68: {
63
+ vivid: { rel: 100, max: 21.9 },
64
+ normal: { rel: 90, min: 15.8, max: 19.8 },
65
+ dim: { rel: 70, min: 9.6, max: 15.8 },
66
+ },
67
+ 72: {
68
+ vivid: { rel: 100, max: 21.2 },
69
+ normal: { rel: 92, min: 14.8, max: 18.8 },
70
+ dim: { rel: 72, min: 8.4, max: 14.8 },
71
+ },
72
+ 76: {
73
+ vivid: { rel: 100, max: 20.3 },
74
+ normal: { rel: 90, min: 13.1, max: 17.5 },
75
+ dim: { rel: 70, min: 7, max: 13.1 },
76
+ },
77
+ 80: {
78
+ vivid: { rel: 100, max: 19 },
79
+ normal: { rel: 88, min: 11.2, max: 15.6 },
80
+ dim: { rel: 68, min: 5.6, max: 11.2 },
81
+ },
82
+ 84: {
83
+ vivid: { rel: 100, max: 17.1 },
84
+ normal: { rel: 86, min: 9, max: 13.4 },
85
+ dim: { rel: 66, min: 4.4, max: 9 },
86
+ },
87
+ 88: {
88
+ vivid: { rel: 100, max: 14.2 },
89
+ normal: { rel: 84, min: 6.7, max: 10.4 },
90
+ dim: { rel: 64, min: 3.2, max: 6.7 },
91
+ },
92
+ 92: {
93
+ vivid: { rel: 100, max: 11 },
94
+ normal: { rel: 82, min: 4.4, max: 7.4 },
95
+ dim: { rel: 62, min: 2.2, max: 4.4 },
96
+ },
97
+ 96: {
98
+ vivid: { rel: 100, max: 7 },
99
+ normal: { rel: 80, min: 2.6, max: 4.4 },
100
+ dim: { rel: 60, min: 1.5, max: 2.6 },
101
+ },
102
+ };
@@ -0,0 +1,109 @@
1
+ export declare const brand: {
2
+ red: string;
3
+ orange: string;
4
+ green: string;
5
+ mint: string;
6
+ blue: string;
7
+ blueDeep: string;
8
+ violet: string;
9
+ purple: string;
10
+ };
11
+ export declare const system: {
12
+ warning: string;
13
+ error: string;
14
+ success: string;
15
+ accent: string;
16
+ };
17
+ export declare const customizable: {
18
+ red: string;
19
+ orange: string;
20
+ green: string;
21
+ mint: string;
22
+ blue: string;
23
+ blueDeep: string;
24
+ violet: string;
25
+ purple: string;
26
+ yellow: string;
27
+ };
28
+ export declare const gray: {
29
+ 0: string;
30
+ 16: string;
31
+ 20: string;
32
+ 24: string;
33
+ 28: string;
34
+ 32: string;
35
+ 36: string;
36
+ 40: string;
37
+ 44: string;
38
+ 48: string;
39
+ 52: string;
40
+ 56: string;
41
+ 60: string;
42
+ 64: string;
43
+ 68: string;
44
+ 72: string;
45
+ 76: string;
46
+ 80: string;
47
+ 84: string;
48
+ 88: string;
49
+ 92: string;
50
+ 96: string;
51
+ 98: string;
52
+ 100: string;
53
+ };
54
+ export declare const whiteAlpha: {
55
+ 4: string;
56
+ 6: string;
57
+ 8: string;
58
+ 12: string;
59
+ 16: string;
60
+ 20: string;
61
+ 24: string;
62
+ 28: string;
63
+ 32: string;
64
+ 36: string;
65
+ 40: string;
66
+ 44: string;
67
+ 48: string;
68
+ 52: string;
69
+ 56: string;
70
+ 60: string;
71
+ 64: string;
72
+ 68: string;
73
+ 72: string;
74
+ 76: string;
75
+ 80: string;
76
+ 84: string;
77
+ 88: string;
78
+ 92: string;
79
+ 96: string;
80
+ 100: string;
81
+ };
82
+ export declare const blackAlpha: {
83
+ 4: string;
84
+ 6: string;
85
+ 8: string;
86
+ 12: string;
87
+ 16: string;
88
+ 20: string;
89
+ 24: string;
90
+ 28: string;
91
+ 32: string;
92
+ 36: string;
93
+ 40: string;
94
+ 44: string;
95
+ 48: string;
96
+ 52: string;
97
+ 56: string;
98
+ 60: string;
99
+ 64: string;
100
+ 68: string;
101
+ 72: string;
102
+ 76: string;
103
+ 80: string;
104
+ 84: string;
105
+ 88: string;
106
+ 92: string;
107
+ 96: string;
108
+ 100: string;
109
+ };
@@ -0,0 +1,109 @@
1
+ export var brand = {
2
+ red: '#FE4C4C',
3
+ orange: '#FC7630',
4
+ green: '#26AD50',
5
+ mint: '#00BEA2',
6
+ blue: '#2291FF',
7
+ blueDeep: '#366AF3',
8
+ violet: '#844BEC',
9
+ purple: '#B750D1',
10
+ };
11
+ export var system = {
12
+ warning: '#FDAA00',
13
+ error: '#E62B34',
14
+ success: '#009A40',
15
+ accent: '#2291FF',
16
+ };
17
+ export var customizable = {
18
+ red: '#FE4C4C',
19
+ orange: '#FC7630',
20
+ green: '#26AD50',
21
+ mint: '#00BEA2',
22
+ blue: '#2291FF',
23
+ blueDeep: '#366AF3',
24
+ violet: '#844BEC',
25
+ purple: '#B750D1',
26
+ yellow: '#FAB700',
27
+ };
28
+ export var gray = {
29
+ 0: 'oklch(0% 0 0)',
30
+ 16: 'oklch(16% 0 0)',
31
+ 20: 'oklch(20% 0 0)',
32
+ 24: 'oklch(24% 0 0)',
33
+ 28: 'oklch(28% 0 0)',
34
+ 32: 'oklch(32% 0 0)',
35
+ 36: 'oklch(36% 0 0)',
36
+ 40: 'oklch(40% 0 0)',
37
+ 44: 'oklch(44% 0 0)',
38
+ 48: 'oklch(48% 0 0)',
39
+ 52: 'oklch(52% 0 0)',
40
+ 56: 'oklch(56% 0 0)',
41
+ 60: 'oklch(60% 0 0)',
42
+ 64: 'oklch(64% 0 0)',
43
+ 68: 'oklch(68% 0 0)',
44
+ 72: 'oklch(72% 0 0)',
45
+ 76: 'oklch(76% 0 0)',
46
+ 80: 'oklch(80% 0 0)',
47
+ 84: 'oklch(84% 0 0)',
48
+ 88: 'oklch(88% 0 0)',
49
+ 92: 'oklch(92% 0 0)',
50
+ 96: 'oklch(96% 0 0)',
51
+ 98: 'oklch(98% 0 0)',
52
+ 100: 'oklch(100% 0 0)',
53
+ };
54
+ export var whiteAlpha = {
55
+ 4: 'oklch(100% 0 0 / 0.04)',
56
+ 6: 'oklch(100% 0 0 / 0.06)',
57
+ 8: 'oklch(100% 0 0 / 0.08)',
58
+ 12: 'oklch(100% 0 0 / 0.12)',
59
+ 16: 'oklch(100% 0 0 / 0.16)',
60
+ 20: 'oklch(100% 0 0 / 0.2)',
61
+ 24: 'oklch(100% 0 0 / 0.24)',
62
+ 28: 'oklch(100% 0 0 / 0.28)',
63
+ 32: 'oklch(100% 0 0 / 0.32)',
64
+ 36: 'oklch(100% 0 0 / 0.36)',
65
+ 40: 'oklch(100% 0 0 / 0.4)',
66
+ 44: 'oklch(100% 0 0 / 0.44)',
67
+ 48: 'oklch(100% 0 0 / 0.48)',
68
+ 52: 'oklch(100% 0 0 / 0.52)',
69
+ 56: 'oklch(100% 0 0 / 0.56)',
70
+ 60: 'oklch(100% 0 0 / 0.6)',
71
+ 64: 'oklch(100% 0 0 / 0.64)',
72
+ 68: 'oklch(100% 0 0 / 0.68)',
73
+ 72: 'oklch(100% 0 0 / 0.72)',
74
+ 76: 'oklch(100% 0 0 / 0.76)',
75
+ 80: 'oklch(100% 0 0 / 0.8)',
76
+ 84: 'oklch(100% 0 0 / 0.84)',
77
+ 88: 'oklch(100% 0 0 / 0.88)',
78
+ 92: 'oklch(100% 0 0 / 0.92)',
79
+ 96: 'oklch(100% 0 0 / 0.96)',
80
+ 100: 'oklch(100% 0 0 / 1)',
81
+ };
82
+ export var blackAlpha = {
83
+ 4: 'oklch(0% 0 0 / 0.04)',
84
+ 6: 'oklch(0% 0 0 / 0.06)',
85
+ 8: 'oklch(0% 0 0 / 0.08)',
86
+ 12: 'oklch(0% 0 0 / 0.12)',
87
+ 16: 'oklch(0% 0 0 / 0.16)',
88
+ 20: 'oklch(0% 0 0 / 0.2)',
89
+ 24: 'oklch(0% 0 0 / 0.24)',
90
+ 28: 'oklch(0% 0 0 / 0.28)',
91
+ 32: 'oklch(0% 0 0 / 0.32)',
92
+ 36: 'oklch(0% 0 0 / 0.36)',
93
+ 40: 'oklch(0% 0 0 / 0.4)',
94
+ 44: 'oklch(0% 0 0 / 0.44)',
95
+ 48: 'oklch(0% 0 0 / 0.48)',
96
+ 52: 'oklch(0% 0 0 / 0.52)',
97
+ 56: 'oklch(0% 0 0 / 0.56)',
98
+ 60: 'oklch(0% 0 0 / 0.6)',
99
+ 64: 'oklch(0% 0 0 / 0.64)',
100
+ 68: 'oklch(0% 0 0 / 0.68)',
101
+ 72: 'oklch(0% 0 0 / 0.72)',
102
+ 76: 'oklch(0% 0 0 / 0.76)',
103
+ 80: 'oklch(0% 0 0 / 0.8)',
104
+ 84: 'oklch(0% 0 0 / 0.84)',
105
+ 88: 'oklch(0% 0 0 / 0.88)',
106
+ 92: 'oklch(0% 0 0 / 0.92)',
107
+ 96: 'oklch(0% 0 0 / 0.96)',
108
+ 100: 'oklch(0% 0 0 / 1)',
109
+ };
@@ -0,0 +1,8 @@
1
+ export declare const HOVER_LIGHT_L = -4;
2
+ export declare const HOVER_LIGHT_C = 0;
3
+ export declare const HOVER_DARK_L = 4;
4
+ export declare const HOVER_DARK_C = 0;
5
+ export declare const PRESSED_LIGHT_L = -8;
6
+ export declare const PRESSED_LIGHT_C = -0.03;
7
+ export declare const PRESSED_DARK_L = -4;
8
+ export declare const PRESSED_DARK_C = -0.03;
@@ -0,0 +1,8 @@
1
+ export var HOVER_LIGHT_L = -4;
2
+ export var HOVER_LIGHT_C = 0;
3
+ export var HOVER_DARK_L = +4;
4
+ export var HOVER_DARK_C = 0;
5
+ export var PRESSED_LIGHT_L = -8;
6
+ export var PRESSED_LIGHT_C = -0.03;
7
+ export var PRESSED_DARK_L = -4;
8
+ export var PRESSED_DARK_C = -0.03;
@@ -0,0 +1 @@
1
+ export declare const MIN_LOGO_LIGHTNESS = 64;
@@ -0,0 +1 @@
1
+ export var MIN_LOGO_LIGHTNESS = 64;
@@ -0,0 +1,3 @@
1
+ export declare const PROMO_HUE_SHIFTS: {
2
+ [hueRange: number]: number;
3
+ };
@@ -0,0 +1,11 @@
1
+ export var PROMO_HUE_SHIFTS = {
2
+ 0: -24,
3
+ 25: -32,
4
+ 44: -35,
5
+ 148: 40,
6
+ 177: 51,
7
+ 253: 11,
8
+ 264: 14,
9
+ 294: 0,
10
+ 319: -24,
11
+ };
@@ -0,0 +1,3 @@
1
+ export declare const WARNING_HUE_PATCH: {
2
+ [lightness: number]: number;
3
+ };
@@ -0,0 +1,22 @@
1
+ export var WARNING_HUE_PATCH = {
2
+ 96: 0,
3
+ 92: 0,
4
+ 88: 0,
5
+ 84: 0,
6
+ 80: 0,
7
+ 76: 0,
8
+ 72: -4,
9
+ 68: -8,
10
+ 64: -12,
11
+ 60: -8,
12
+ 56: -4,
13
+ 52: -2,
14
+ 48: 0,
15
+ 44: 0,
16
+ 40: 0,
17
+ 36: 0,
18
+ 32: 0,
19
+ 28: 0,
20
+ 24: 0,
21
+ 20: 0,
22
+ };
@@ -0,0 +1,19 @@
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 interface ConfigOptions {
11
+ brand: PresetOrCustom<keyof typeof DEFAULT_SWATCH.brand>;
12
+ accent: PresetOrCustom<(typeof ACCENT_PARAMS)[number]>;
13
+ system?: typeof DEFAULT_SWATCH.system;
14
+ }
15
+ export declare function getBaseTokens({ brand, accent, system }: ConfigOptions): BaseTokens;
16
+ export declare function convertOklchToHex(obj: ColorStructure): ColorStructure;
17
+ export declare const convertOklchToRgba: (oklchString: string) => string;
18
+ export declare function convertAlphaOklchToRgba(obj: ColorStructure): ColorStructure;
19
+ export {};
@@ -0,0 +1,147 @@
1
+ import { converter, formatHex } from 'culori';
2
+ import { calcOnBrand, getPalette } from './helpers/get-palette';
3
+ import { getPromo } from './helpers/get-promo';
4
+ import * as DEFAULT_SWATCH from './constants/default-swatch';
5
+ import { getLogo } from './helpers/get-logo';
6
+ import { getHover, getPressed } from './helpers/get-interactions';
7
+ export var ACCENT_PARAMS = ['brand', 'gray'];
8
+ export function getBaseTokens(_a) {
9
+ var brand = _a.brand,
10
+ _b = _a.accent,
11
+ accent = _b === void 0 ? 'gray' : _b,
12
+ _c = _a.system,
13
+ system = _c === void 0 ? DEFAULT_SWATCH.system : _c;
14
+ var isPresetColor = brand in DEFAULT_SWATCH.brand;
15
+ var brandColor;
16
+ if (isPresetColor) {
17
+ brandColor = DEFAULT_SWATCH.brand[brand];
18
+ } else {
19
+ brandColor = brand;
20
+ }
21
+ var accentColor;
22
+ if (accent === 'brand') {
23
+ accentColor = brandColor;
24
+ } else if (accent !== 'gray') {
25
+ accentColor = accent;
26
+ }
27
+ var brandPalette = getPalette({ color: brandColor });
28
+ var accentPalette;
29
+ if (accent === 'brand') {
30
+ accentPalette = brandPalette;
31
+ } else if (accent !== 'gray' && accentColor) {
32
+ accentPalette = getPalette({ color: accentColor });
33
+ }
34
+ var customizablePalettes = {};
35
+ for (var colorKey in DEFAULT_SWATCH.customizable) {
36
+ var key = colorKey;
37
+ if (key === brand && isPresetColor) {
38
+ customizablePalettes[key] = brandPalette;
39
+ continue;
40
+ }
41
+ customizablePalettes[key] = getPalette({
42
+ color: DEFAULT_SWATCH.customizable[key],
43
+ });
44
+ }
45
+ return {
46
+ brand: {
47
+ logo: getLogo(brandColor),
48
+ promo: getPromo(brandColor),
49
+ original: brandColor,
50
+ interactions: {
51
+ hover: getHover(brandColor),
52
+ pressed: getPressed(brandColor),
53
+ },
54
+ palette: brandPalette,
55
+ },
56
+ accent: accentColor
57
+ ? {
58
+ original: {
59
+ light: accentColor,
60
+ dark: accentColor,
61
+ },
62
+ interactions: {
63
+ hover: getHover(accentColor),
64
+ pressed: getPressed(accentColor),
65
+ },
66
+ palette: accentPalette,
67
+ }
68
+ : undefined,
69
+ warning: getPalette({ color: system.warning }),
70
+ error: getPalette({ color: system.error }),
71
+ success: getPalette({ color: system.success }),
72
+ gray: DEFAULT_SWATCH.gray,
73
+ whiteAlpha: DEFAULT_SWATCH.whiteAlpha,
74
+ blackAlpha: DEFAULT_SWATCH.blackAlpha,
75
+ onBrand: calcOnBrand(brandColor),
76
+ onAccent: accentColor ? calcOnBrand(accentColor) : undefined,
77
+ customizable: customizablePalettes,
78
+ };
79
+ }
80
+ export function convertOklchToHex(obj) {
81
+ if (typeof obj !== 'object' || obj === null) {
82
+ return obj;
83
+ }
84
+ if (Array.isArray(obj)) {
85
+ return obj.map(function (item) {
86
+ if (typeof item === 'object' && item !== null) {
87
+ return convertOklchToHex(item);
88
+ }
89
+ return item;
90
+ });
91
+ }
92
+ var newObj = {};
93
+ for (var key in obj) {
94
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
95
+ var value = obj[key];
96
+ if (typeof value === 'string' && value.startsWith('oklch(') && !value.includes('/')) {
97
+ var oklchColor = converter('oklch')(value);
98
+ var rgbColor = converter('rgb')(oklchColor);
99
+ value = formatHex(rgbColor);
100
+ }
101
+ if (typeof value === 'object' && value !== null) {
102
+ newObj[key] = convertOklchToHex(value);
103
+ } else {
104
+ newObj[key] = value;
105
+ }
106
+ }
107
+ }
108
+ return newObj;
109
+ }
110
+ export var convertOklchToRgba = function (oklchString) {
111
+ var _a;
112
+ var oklch = converter('oklch')(oklchString);
113
+ var rgb = converter('rgb')(oklch);
114
+ var r = Math.round(rgb.r * 255);
115
+ var g = Math.round(rgb.g * 255);
116
+ var b = Math.round(rgb.b * 255);
117
+ var alpha = (_a = oklch.alpha) !== null && _a !== void 0 ? _a : 1;
118
+ return 'rgba('.concat(r, ', ').concat(g, ', ').concat(b, ', ').concat(alpha, ')');
119
+ };
120
+ export function convertAlphaOklchToRgba(obj) {
121
+ if (typeof obj !== 'object' || obj === null) {
122
+ return obj;
123
+ }
124
+ if (Array.isArray(obj)) {
125
+ return obj.map(function (item) {
126
+ if (typeof item === 'object' && item !== null) {
127
+ return convertAlphaOklchToRgba(item);
128
+ }
129
+ return item;
130
+ });
131
+ }
132
+ var newObj = {};
133
+ for (var key in obj) {
134
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
135
+ var value = obj[key];
136
+ if (typeof value === 'string' && value.includes('oklch(')) {
137
+ value = convertOklchToRgba(value);
138
+ }
139
+ if (typeof value === 'object' && value !== null) {
140
+ newObj[key] = convertAlphaOklchToRgba(value);
141
+ } else {
142
+ newObj[key] = value;
143
+ }
144
+ }
145
+ }
146
+ return newObj;
147
+ }
@@ -0,0 +1,19 @@
1
+ import { type ConfigOptions } 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
+ }
14
+ export declare function getColors(params: SemanticConfigOptions<DefaultTokens>): DefaultTokens;
15
+ export declare function getColors<T>(
16
+ params: SemanticConfigOptions<T> & {
17
+ overrides: (base: BaseTokens) => Themed<T>;
18
+ }
19
+ ): Themed<T>;
@@ -0,0 +1,12 @@
1
+ import { getBaseTokens } from './get-base-tokens';
2
+ import { getDefaultTokens } from './get-default-tokens';
3
+ var DEFAULT_THEME = 'light';
4
+ export function getColors(params) {
5
+ var theme = params.theme || DEFAULT_THEME;
6
+ var base = getBaseTokens(params);
7
+ var defaults = getDefaultTokens(base);
8
+ if (params.overrides) {
9
+ return params.overrides(base, defaults, params)[theme];
10
+ }
11
+ return defaults[theme];
12
+ }