@acorex/styles 19.10.0-next.1 → 19.10.0-next.10

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 (53) hide show
  1. package/base/index.scss +15 -0
  2. package/{src/shared → components}/_action-item.scss +3 -3
  3. package/{src/shared → components}/_actionsheet.scss +7 -6
  4. package/{src/shared → components}/_check-box.scss +8 -14
  5. package/{src/shared → components}/_drop-down.scss +15 -17
  6. package/components/_editor-container.scss +260 -0
  7. package/{src/shared → components}/_general-button.scss +11 -12
  8. package/{src/shared → components}/_list.scss +15 -41
  9. package/{src/shared → components}/_radio.scss +8 -14
  10. package/components/_ripple.scss +13 -0
  11. package/{src/shared → components}/_table.scss +9 -30
  12. package/components/_uploader.scss +44 -0
  13. package/{src/shared → components}/index.scss +2 -3
  14. package/icons/fontawesome/index.scss +10 -11
  15. package/icons/huge/huge-bulk/index.scss +4 -4
  16. package/icons/huge/huge-duotone/index.scss +4 -4
  17. package/icons/huge/huge-solid-sharp/index.scss +4 -4
  18. package/icons/huge/huge-solid-standard/index.scss +4 -4
  19. package/icons/huge/huge-stroke-rounded/index.scss +4 -4
  20. package/icons/huge/huge-stroke-sharp/index.scss +4 -4
  21. package/icons/huge/huge-stroke-standard/index.scss +4 -4
  22. package/icons/huge/huge-twotone/index.scss +4 -4
  23. package/icons/material/index.scss +4 -5
  24. package/index.scss +5 -7
  25. package/mixins/_editor-looks.scss +23 -0
  26. package/mixins/_scroll-bar.scss +23 -0
  27. package/mixins/index.scss +4 -0
  28. package/package.json +1 -1
  29. package/tailwind-base.js +231 -158
  30. package/themes/default.scss +37 -141
  31. package/utils/_theme-generator.scss +230 -0
  32. package/utils/_utils.scss +276 -0
  33. package/utils/index.scss +2 -0
  34. package/variables/_colors.scss +7 -0
  35. package/variables/_looks.scss +1 -0
  36. package/variables/index.scss +2 -0
  37. package/index.css +0 -2843
  38. package/index.min.css +0 -1
  39. package/src/base/index.scss +0 -13
  40. package/src/mixins/_look.scss +0 -83
  41. package/src/mixins/index.scss +0 -3
  42. package/src/shared/_color-look.scss +0 -822
  43. package/src/shared/_editor-container.scss +0 -291
  44. package/src/shared/_inputs.scss +0 -16
  45. package/src/shared/_utils.scss +0 -85
  46. package/src/utility/index.scss +0 -24
  47. package/src/variables/_colors.scss +0 -2
  48. package/src/variables/_degrees.scss +0 -1
  49. package/src/variables/index.scss +0 -2
  50. package/themes/default.css +0 -1
  51. /package/{src/base → base}/_preflight.scss +0 -0
  52. /package/{src/mixins → mixins}/_media.scss +0 -0
  53. /package/{src/mixins → mixins}/_util.scss +0 -0
@@ -1,145 +1,41 @@
1
+ @use '../utils/index.scss' as *;
2
+
3
+ $theme-colors: (
4
+ 'primary': oklch(0.623 0.214 259.815),
5
+ 'secondary': oklch(0.554 0.046 257.417),
6
+ 'success': oklch(0.696 0.17 162.48),
7
+ 'warning': oklch(0.769 0.188 70.08),
8
+ 'danger': (
9
+ oklch(0.645 0.246 16.439),
10
+ oklch(0.712 0.194 13.428),
11
+ ),
12
+ );
13
+
14
+ $theme-surfaces: (
15
+ 'light-start': #ffffff,
16
+ 'light-end': #d4d4d4,
17
+ 'dark-start': #27272a,
18
+ 'dark-end': #09090b,
19
+ );
20
+
21
+ $options: (
22
+ 'color-range': true,
23
+ 'light': #ffffff,
24
+ 'dark': #09090b,
25
+ );
26
+
27
+ @forward '../variables/index.scss';
28
+
1
29
  :root,
2
30
  .ax-light {
3
- --ax-size-base: 2.5rem;
4
- --ax-size-default: var(--ax-size-base);
5
- --ax-icon-weight: 400;
6
- --ax-icon-size: 100%;
7
-
8
- --ax-rounded-border-default: 0.5rem;
9
-
10
- --ax-color-border-default: 233, 234, 235;
11
-
12
- --ax-color-background-default: 249, 250, 251;
13
- --ax-color-text-default: 22, 22, 22;
14
-
15
- --ax-color-surface: 255, 255, 255;
16
- --ax-color-surface-fore: 22, 22, 22;
17
-
18
- --ax-color-on-surface: 250, 250, 250;
19
- --ax-color-on-surface-fore: 22, 22, 22;
20
-
21
- --ax-color-input-surface: 255, 255, 255;
22
- --ax-color-input-surface-fore: 22, 22, 22;
23
- --ax-color-input-border: 213, 215, 218;
24
-
25
- --ax-color-ghost: 255, 255, 255;
26
- --ax-color-ghost-fore: 22, 22, 22;
27
-
28
- --ax-color-primary-fore: 255, 255, 255;
29
- --ax-color-primary-fore-tint: 11, 30, 71;
30
- --ax-color-primary-50: 244, 247, 254;
31
- --ax-color-primary-100: 233, 239, 253;
32
- --ax-color-primary-200: 190, 208, 249;
33
- --ax-color-primary-300: 146, 177, 245;
34
- --ax-color-primary-400: 102, 146, 241;
35
- --ax-color-primary-500: 37, 99, 235;
36
- --ax-color-primary-600: 33, 89, 212;
37
- --ax-color-primary-700: 26, 69, 165;
38
- --ax-color-primary-800: 19, 50, 118;
39
- --ax-color-primary-900: 11, 30, 71;
40
- --ax-color-primary-950: 4, 10, 23;
41
-
42
- --ax-color-secondary-fore: 255, 255, 255;
43
- --ax-color-secondary-fore-tint: 9, 12, 18;
44
- --ax-color-secondary-50: 244, 244, 245;
45
- --ax-color-secondary-100: 233, 234, 235;
46
- --ax-color-secondary-200: 188, 191, 196;
47
- --ax-color-secondary-300: 143, 148, 157;
48
- --ax-color-secondary-400: 98, 105, 118;
49
- --ax-color-secondary-500: 30, 41, 59;
50
- --ax-color-secondary-600: 27, 37, 53;
51
- --ax-color-secondary-700: 21, 29, 41;
52
- --ax-color-secondary-800: 15, 21, 30;
53
- --ax-color-secondary-900: 9, 12, 18;
54
- --ax-color-secondary-950: 3, 4, 6;
55
-
56
- --ax-color-success-fore: 255, 255, 255;
57
- --ax-color-success-fore-tint: 6, 78, 59;
58
- --ax-color-success-50: 236, 253, 245;
59
- --ax-color-success-100: 209, 250, 229;
60
- --ax-color-success-200: 167, 243, 208;
61
- --ax-color-success-300: 110, 231, 183;
62
- --ax-color-success-400: 52, 211, 153;
63
- --ax-color-success-500: 16, 185, 129;
64
- --ax-color-success-600: 5, 150, 105;
65
- --ax-color-success-700: 4, 120, 87;
66
- --ax-color-success-800: 6, 95, 70;
67
- --ax-color-success-900: 6, 78, 59;
68
- --ax-color-success-950: 2, 44, 34;
69
-
70
- --ax-color-warning-fore: 48, 26, 10;
71
- --ax-color-warning-fore-tint: 255, 111, 0;
72
- --ax-color-warning-50: 255, 248, 225;
73
- --ax-color-warning-100: 255, 236, 179;
74
- --ax-color-warning-200: 255, 224, 130;
75
- --ax-color-warning-300: 255, 213, 79;
76
- --ax-color-warning-400: 255, 202, 40;
77
- --ax-color-warning-500: 255, 193, 7;
78
- --ax-color-warning-600: 255, 179, 0;
79
- --ax-color-warning-700: 255, 160, 0;
80
- --ax-color-warning-800: 255, 143, 0;
81
- --ax-color-warning-900: 255, 111, 0;
82
- --ax-color-warning-950: 72, 40, 15;
83
-
84
- --ax-color-danger-fore: 255, 255, 255;
85
- --ax-color-danger-fore-tint: 127, 29, 29;
86
- --ax-color-danger-50: 254, 242, 242;
87
- --ax-color-danger-100: 254, 226, 226;
88
- --ax-color-danger-200: 254, 202, 202;
89
- --ax-color-danger-300: 252, 165, 165;
90
- --ax-color-danger-400: 248, 113, 113;
91
- --ax-color-danger-500: 239, 68, 68;
92
- --ax-color-danger-600: 220, 38, 38;
93
- --ax-color-danger-700: 185, 28, 28;
94
- --ax-color-danger-800: 153, 27, 27;
95
- --ax-color-danger-900: 127, 29, 29;
96
- --ax-color-danger-950: 69, 10, 10;
97
-
98
- --ax-color-info-fore: 255, 255, 255;
99
- --ax-color-info-fore-tint: 49, 46, 129;
100
- --ax-color-info-50: 238, 242, 255;
101
- --ax-color-info-100: 224, 231, 255;
102
- --ax-color-info-200: 199, 210, 254;
103
- --ax-color-info-300: 165, 180, 252;
104
- --ax-color-info-400: 129, 140, 248;
105
- --ax-color-info-500: 99, 102, 241;
106
- --ax-color-info-600: 79, 70, 229;
107
- --ax-color-info-700: 67, 56, 202;
108
- --ax-color-info-800: 55, 48, 163;
109
- --ax-color-info-900: 49, 46, 129;
110
- --ax-color-info-950: 30, 27, 75;
111
-
112
- --ax-color-neutral-fore: 255, 255, 255;
113
- --ax-color-neutral-fore-tint: 17, 24, 39;
114
- --ax-color-neutral-50: 249, 250, 251;
115
- --ax-color-neutral-100: 243, 244, 246;
116
- --ax-color-neutral-200: 229, 231, 235;
117
- --ax-color-neutral-300: 209, 213, 219;
118
- --ax-color-neutral-400: 156, 163, 175;
119
- --ax-color-neutral-500: 107, 114, 128;
120
- --ax-color-neutral-600: 75, 85, 99;
121
- --ax-color-neutral-700: 55, 65, 81;
122
- --ax-color-neutral-800: 31, 41, 55;
123
- --ax-color-neutral-900: 17, 24, 39;
124
- --ax-color-neutral-950: 3, 7, 18;
31
+ --ax-sys-body-font-size: 1rem;
32
+ --ax-sys-size-base: 2.5rem;
33
+ --ax-sys-border-radius: 0.5rem;
34
+ --ax-sys-color-body-text: 0, 0, 0;
35
+ --ax-sys-color-input-text: 0, 0, 0;
36
+
37
+ // --ax-sys-body-bg-color: var(--ax-sys-color-surface-lowest);
38
+ // --ax-sys-body-text-color: var(--ax-sys-color-surface-lowest-border);
125
39
  }
126
40
 
127
- .ax-dark {
128
- --ax-color-border-default: 34, 38, 47;
129
-
130
- --ax-color-background-default: 12, 14, 18;
131
- --ax-color-text-default: 255, 255, 255;
132
-
133
- --ax-color-surface: 19, 22, 27;
134
- --ax-color-surface-fore: 255, 255, 255;
135
-
136
- --ax-color-on-surface: 34, 38, 47;
137
- --ax-color-on-surface-fore: 255, 255, 255;
138
-
139
- --ax-color-input-surface: 12, 14, 18;
140
- --ax-color-input-surface-fore: 224, 224, 224;
141
- --ax-color-input-border: 55, 58, 65;
142
-
143
- --ax-color-ghost: 77, 91, 113;
144
- --ax-color-ghost-fore: 255, 255, 255;
145
- }
41
+ @include generate-pallete-variables($theme-colors, $theme-surfaces, $options);
@@ -0,0 +1,230 @@
1
+ @use './utils' as *;
2
+ @use 'sass:color';
3
+ @use 'sass:meta';
4
+ @use 'sass:math';
5
+ @use 'sass:map';
6
+ @use 'sass:list';
7
+
8
+ @function generate-surfaces-colors-variables($surfaces, $options) {
9
+ $light-color: if(map.has-key($options, 'light'), map.get($options, 'light'), #f0f0f0);
10
+ $neutral-color: if(map.has-key($options, 'neutral'), map.get($options, 'neutral'), #808080);
11
+ $dark-color: if(map.has-key($options, 'dark'), map.get($options, 'dark'), #303030);
12
+ //
13
+ $is-dark: if(map.has-key($options, 'is-dark'), map.get($options, 'is-dark'), false);
14
+ //
15
+ $dark-start-color: map.get($surfaces, 'dark-start');
16
+ $dark-end-color: map.get($surfaces, 'dark-end');
17
+ // Extract the start and end colors for both light and dark themes
18
+ $start-color: map.get($surfaces, 'light-start');
19
+ $end-color: map.get($surfaces, 'light-end');
20
+
21
+ // If the dark theme is enabled, use the dark theme colors
22
+ @if $is-dark {
23
+ $start-color: map.get($surfaces, 'dark-start');
24
+ $end-color: map.get($surfaces, 'dark-end');
25
+ }
26
+
27
+ // Lightest Surface (start color)
28
+ $lightest-surface: $start-color;
29
+ $on-lightest-surface: contrast-text($lightest-surface, $is-dark);
30
+ $lightest-surface-border: border-color($lightest-surface, $is-dark);
31
+
32
+ // Lighter Surface: 80% of $start-color
33
+ $lighter-surface: color.mix($start-color, $end-color, 80%);
34
+ $on-lighter-surface: contrast-text($lighter-surface, $is-dark);
35
+ $lighter-surface-border: border-color($lighter-surface, $is-dark);
36
+
37
+ // Light Surface: 65% of $start-color
38
+ $light-surface: color.mix($start-color, $end-color, 65%);
39
+ $on-light-surface: contrast-text($light-surface, $is-dark);
40
+ $light-surface-border: border-color($light-surface, $is-dark);
41
+
42
+ // Base Surface: 50% of $start-color (the midpoint)
43
+ $surface: color.mix($start-color, $end-color, 50%);
44
+ $on-surface: contrast-text($surface, $is-dark);
45
+ $surface-border: border-color($surface, $is-dark);
46
+
47
+ // Dark Surface: 35% of $start-color
48
+ $dark-surface: color.mix($start-color, $end-color, 35%);
49
+ $on-dark-surface: contrast-text($dark-surface, $is-dark);
50
+ $dark-surface-border: border-color($dark-surface, $is-dark);
51
+
52
+ // Darker Surface: 20% of $start-color
53
+ $darker-surface: color.mix($start-color, $end-color, 20%);
54
+ $on-darker-surface: contrast-text($darker-surface, $is-dark);
55
+ $darker-surface-border: border-color($darker-surface, $is-dark);
56
+
57
+ // Darkest Surface (end color)
58
+ $darkest-surface: $end-color;
59
+ $on-darkest-surface: contrast-text($darkest-surface, $is-dark);
60
+ $darkest-surface-border: border-color($darkest-surface, $is-dark);
61
+
62
+ @return (
63
+ ax-sys-color-light: $light-color,
64
+ ax-sys-color-neutral: $neutral-color,
65
+ ax-sys-color-dark: $dark-color,
66
+ //
67
+ ax-sys-color-lightest-surface: $lightest-surface,
68
+ ax-sys-color-on-lightest-surface: $on-lightest-surface,
69
+ ax-sys-color-border-lightest-surface: $lightest-surface-border,
70
+
71
+ ax-sys-color-lighter-surface: $lighter-surface,
72
+ ax-sys-color-on-lighter-surface: $on-lighter-surface,
73
+ ax-sys-color-border-lighter-surface: $lighter-surface-border,
74
+
75
+ ax-sys-color-light-surface: $light-surface,
76
+ ax-sys-color-on-light-surface: $on-light-surface,
77
+ ax-sys-color-border-light-surface: $light-surface-border,
78
+
79
+ ax-sys-color-surface: $surface,
80
+ ax-sys-color-on-surface: $on-surface,
81
+ ax-sys-color-border-surface: $surface-border,
82
+
83
+ ax-sys-color-dark-surface: $dark-surface,
84
+ ax-sys-color-on-dark-surface: $on-dark-surface,
85
+ ax-sys-color-border-dark-surface: $dark-surface-border,
86
+
87
+ ax-sys-color-darker-surface: $darker-surface,
88
+ ax-sys-color-on-darker-surface: $on-darker-surface,
89
+ ax-sys-color-border-darker-surface: $darker-surface-border,
90
+
91
+ ax-sys-color-darkest-surface: $darkest-surface,
92
+ ax-sys-color-on-darkest-surface: $on-darkest-surface,
93
+ ax-sys-color-border-darkest-surface: $darkest-surface-border
94
+ );
95
+ }
96
+
97
+ @function generate-named-surfaces-variables($name, $color, $is-dark: false) {
98
+ $palette: light-palette-generator($color);
99
+ @if $is-dark {
100
+ $palette: dark-palette-generator($color);
101
+ }
102
+
103
+ // Lightest Surface
104
+ $lightest-surface: oklch-to-rgba(map.get($palette, 100));
105
+ $on-lightest-surface: contrast-text($lightest-surface, $is-dark);
106
+ $lightest-surface-border: border-color($lightest-surface, $is-dark);
107
+
108
+ // Lighter Surface
109
+ $lighter-surface: oklch-to-rgba(map.get($palette, 200));
110
+ $on-lighter-surface: contrast-text($lighter-surface, $is-dark);
111
+ $lighter-surface-border: border-color($lighter-surface, $is-dark);
112
+
113
+ // Light Surface
114
+ $light-surface: oklch-to-rgba(map.get($palette, 300));
115
+ $on-light-surface: contrast-text($light-surface, $is-dark);
116
+ $light-surface-border: border-color($light-surface, $is-dark);
117
+
118
+ // Base Surface
119
+ $surface: oklch-to-rgba(map.get($palette, 500));
120
+ $on-surface: contrast-text($surface, $is-dark);
121
+ $surface-border: border-color($surface, $is-dark);
122
+
123
+ // Dark Surface
124
+ $dark-surface: oklch-to-rgba(map.get($palette, 600));
125
+ $on-dark-surface: contrast-text($dark-surface, $is-dark);
126
+ $dark-surface-border: border-color($dark-surface, $is-dark);
127
+
128
+ // Darker Surface
129
+ $darker-surface: oklch-to-rgba(map.get($palette, 700));
130
+ $on-darker-surface: contrast-text($darker-surface, $is-dark);
131
+ $darker-surface-border: border-color($darker-surface, $is-dark);
132
+
133
+ // Darkest Surface
134
+ $darkest-surface: oklch-to-rgba(map.get($palette, 800));
135
+ $on-darkest-surface: contrast-text($darkest-surface, $is-dark);
136
+ $darkest-surface-border: border-color($darkest-surface, $is-dark);
137
+
138
+ @return (
139
+ ax-sys-color-#{$name}-lightest-surface: $lightest-surface,
140
+ ax-sys-color-on-#{$name}-lightest-surface: $on-lightest-surface,
141
+ ax-sys-color-border-#{$name}-lightest-surface: $lightest-surface-border,
142
+
143
+ ax-sys-color-#{$name}-lighter-surface: $lighter-surface,
144
+ ax-sys-color-on-#{$name}-lighter-surface: $on-lighter-surface,
145
+ ax-sys-color-border-#{$name}-lighter-surface: $lighter-surface-border,
146
+
147
+ ax-sys-color-#{$name}-light-surface: $light-surface,
148
+ ax-sys-color-on-#{$name}-light-surface: $on-light-surface,
149
+ ax-sys-color-border-#{$name}-light-surface: $light-surface-border,
150
+
151
+ ax-sys-color-#{$name}-surface: $surface,
152
+ ax-sys-color-on-#{$name}-surface: $on-surface,
153
+ ax-sys-color-border-#{$name}-surface: $surface-border,
154
+
155
+ ax-sys-color-#{$name}-dark-surface: $dark-surface,
156
+ ax-sys-color-on-#{$name}-dark-surface: $on-dark-surface,
157
+ ax-sys-color-border-#{$name}-dark-surface: $dark-surface-border,
158
+
159
+ ax-sys-color-#{$name}-darker-surface: $darker-surface,
160
+ ax-sys-color-on-#{$name}-darker-surface: $on-darker-surface,
161
+ ax-sys-color-border-#{$name}-darker-surface: $darker-surface-border,
162
+
163
+ ax-sys-color-#{$name}-darkest-surface: $darkest-surface,
164
+ ax-sys-color-on-#{$name}-darkest-surface: $on-darkest-surface,
165
+ ax-sys-color-border-#{$name}-darkest-surface: $darkest-surface-border
166
+ );
167
+ }
168
+
169
+ @mixin generate-pallete-variables($colors, $theme-surfaces, $options) {
170
+ $generate-color-range: map.get($options, 'color-range');
171
+
172
+ /************** Light Palette **************/
173
+ $options: map.deep-merge(
174
+ $options,
175
+ (
176
+ 'is-dark': false,
177
+ )
178
+ );
179
+ :root,
180
+ .ax-light {
181
+ // Generate Base Surfaces
182
+ @include convert-to-rgb(generate-surfaces-colors-variables($theme-surfaces, $options));
183
+ // Generate Ranges
184
+ @if $generate-color-range {
185
+ /* Ranges */
186
+ @each $name, $color in $colors {
187
+ @if (meta.type-of($color) == list) {
188
+ $color: list.nth($color, 1);
189
+ }
190
+ @include convert-to-rgb(generate-color-ranges-variables($name, $color, false));
191
+ }
192
+ }
193
+ // Generate Colored Surfaces
194
+ @each $name, $color in $colors {
195
+ @if (meta.type-of($color) == list) {
196
+ $color: list.nth($color, 1);
197
+ }
198
+ @include convert-to-rgb(generate-named-surfaces-variables($name, $color, false));
199
+ }
200
+ }
201
+
202
+ /************** Dark Palette **************/
203
+ $options: map.deep-merge(
204
+ $options,
205
+ (
206
+ 'is-dark': true,
207
+ )
208
+ );
209
+ .ax-dark {
210
+ // Generate Base Surfaces
211
+ @include convert-to-rgb(generate-surfaces-colors-variables($theme-surfaces, $options));
212
+ // Generate Ranges
213
+ @if $generate-color-range {
214
+ /* Ranges */
215
+ @each $name, $color in $colors {
216
+ @if (meta.type-of($color) == list) {
217
+ $color: list.nth($color, 2);
218
+ }
219
+ @include convert-to-rgb(generate-color-ranges-variables($name, $color, true));
220
+ }
221
+ }
222
+ // Generate Colored Surfaces
223
+ @each $name, $color in $colors {
224
+ @if (meta.type-of($color) == list) {
225
+ $color: list.nth($color, 2);
226
+ }
227
+ @include convert-to-rgb(generate-named-surfaces-variables($name, $color, true));
228
+ }
229
+ }
230
+ }
@@ -0,0 +1,276 @@
1
+ @use 'sass:color';
2
+ @use 'sass:meta';
3
+ @use 'sass:math';
4
+ @use 'sass:map';
5
+
6
+ @function strip-rgba($color) {
7
+ @if meta.type-of($color) == 'color' {
8
+ $r: math.round(color.channel($color, 'red', rgb));
9
+ $g: math.round(color.channel($color, 'green', rgb));
10
+ $b: math.round(color.channel($color, 'blue', rgb));
11
+ @return $r, $g, $b;
12
+ }
13
+ @error "Invalid input: #{$color}. It must be a color.";
14
+ }
15
+
16
+ @mixin convert-to-rgb($variable-map) {
17
+ @each $key, $value in $variable-map {
18
+ --#{$key}: #{strip-rgba($value)};
19
+ }
20
+ }
21
+
22
+ // A helper function to clamp a value between $min and $max.
23
+ // Renamed to avoid conflict with the built-in `clamp()` function.
24
+ @function clamp-value($value, $min, $max) {
25
+ @return max($min, min($value, $max));
26
+ }
27
+
28
+ // Gamma correction for converting linear sRGB to sRGB.
29
+ // Uses the piecewise function:
30
+ // if (channel <= 0.0031308) then sRGB = 12.92 * channel
31
+ // else sRGB = 1.055 * (channel^(1/2.4)) - 0.055
32
+ @function gamma-correct($channel) {
33
+ @if $channel <= 0.0031308 {
34
+ @return 12.92 * $channel;
35
+ } @else {
36
+ @return 1.055 * math.pow($channel, 1/2.4) - 0.055;
37
+ }
38
+ }
39
+
40
+ // Converts an Oklch value to an rgba() color.
41
+ // The input can be either:
42
+ // • a color (e.g. one produced by `oklch()`), or
43
+ // • a list of numbers: (L, C, H) or (L, C, H, alpha)
44
+ // In the first case, the built-in color channels are used via `color.channel()`.
45
+ // In the second, a manual conversion is performed.
46
+ @function oklch-to-rgba($color) {
47
+ // If the input is a color, extract its components using the new API.
48
+ @if meta.type-of($color) == 'color' {
49
+ $r: round(color.channel($color, 'red', $space: rgb));
50
+ $g: round(color.channel($color, 'green', $space: rgb));
51
+ $b: round(color.channel($color, 'blue', $space: rgb));
52
+ $a: color.channel($color, 'alpha', $space: rgb);
53
+ @return rgba($r, $g, $b, $a);
54
+ }
55
+ // Otherwise, if the input is a list with at least 3 elements, assume it's (L, C, H, [alpha]).
56
+ @else if type-of($color) == 'list' {
57
+ @if length($color) >= 3 {
58
+ $l: nth($color, 1);
59
+ $c: nth($color, 2);
60
+ $h: nth($color, 3);
61
+ $alpha: if(length($color) >= 4, nth($color, 4), 1);
62
+
63
+ // Convert hue from degrees to radians.
64
+ $h_rad: $h * math.pi() / 180;
65
+
66
+ // Convert from Oklch to OKLab.
67
+ $a: $c * math.cos($h_rad);
68
+ $b: $c * math.sin($h_rad);
69
+
70
+ // Compute intermediate OKLab values.
71
+ $l_oklab: $l;
72
+ $l_: $l_oklab + 0.3963377774 * $a + 0.2158037573 * $b;
73
+ $m_: $l_oklab - 0.1055613458 * $a - 0.0638541728 * $b;
74
+ $s_: $l_oklab - 0.0894841775 * $a - 1.291485548 * $b;
75
+
76
+ // Cube the intermediate values.
77
+ $l_cube: $l_ * $l_ * $l_;
78
+ $m_cube: $m_ * $m_ * $m_;
79
+ $s_cube: $s_ * $s_ * $s_;
80
+
81
+ // Convert OKLab (cubed) to linear sRGB.
82
+ $r_linear: 4.0767416621 * $l_cube - 3.3077115913 * $m_cube + 0.2309699292 * $s_cube;
83
+ $g_linear: -1.2684380046 * $l_cube + 2.6097574011 * $m_cube - 0.3413193965 * $s_cube;
84
+ $b_linear: -0.0041960863 * $l_cube - 0.7034186147 * $m_cube + 1.707614701 * $s_cube;
85
+
86
+ // Gamma correction.
87
+ $r: gamma-correct($r_linear);
88
+ $g: gamma-correct($g_linear);
89
+ $b: gamma-correct($b_linear);
90
+
91
+ // Clamp the sRGB values to the 0–1 range.
92
+ $r: clamp-value($r, 0, 1);
93
+ $g: clamp-value($g, 0, 1);
94
+ $b: clamp-value($b, 0, 1);
95
+
96
+ // Convert the 0–1 values to 0–255 integers.
97
+ $r_int: round($r * 255);
98
+ $g_int: round($g * 255);
99
+ $b_int: round($b * 255);
100
+
101
+ @return rgba($r_int, $g_int, $b_int, $alpha);
102
+ } @else {
103
+ @error "Invalid input for oklch-to-rgba: list must have at least 3 elements.";
104
+ }
105
+ } @else {
106
+ @error "Invalid input for oklch-to-rgba: expected a color or a list of numbers.";
107
+ }
108
+ }
109
+
110
+ @function shift-dark-mode-color($color, $lightness: 20%, $saturation: 10%) {
111
+ // Convert the color to HSL
112
+ $hsl: hsl(hue($color), saturation($color), lightness($color));
113
+
114
+ // Check if the color is already dark (lightness < 40%)
115
+ @if lightness($hsl) < 40% {
116
+ // If the color is dark, adjust it slightly or leave it unchanged
117
+ @return $color; // Or adjust slightly, e.g., darken($color, 5%);
118
+ } @else {
119
+ // If the color is light, darken it
120
+ $new-lightness: max(0%, lightness($hsl) - $lightness); // Ensure lightness doesn't go below 0%
121
+ $new-saturation: min(100%, saturation($hsl) + $saturation); // Ensure saturation doesn't exceed 100%
122
+ @return hsl(hue($hsl), $new-saturation, $new-lightness);
123
+ }
124
+ }
125
+
126
+ // Function to calculate text color based on surface color
127
+ @function lightness-calc($hue) {
128
+ @if ($hue <= 80) {
129
+ @return 0.06 * $hue + 75;
130
+ }
131
+ @if ($hue < 270) {
132
+ @return -0.07 * $hue + 85.82;
133
+ }
134
+ @return 0.09 * $hue + 42.6;
135
+ }
136
+ @function is-dark-on-surface($lightness, $hue, $is-dark) {
137
+ @if ($is-dark) {
138
+ @return $lightness >= math.div(lightness-calc(math.div($hue, 1deg)) - 15, 100);
139
+ } @else {
140
+ @return $lightness >= math.div(lightness-calc(math.div($hue, 1deg)), 100);
141
+ }
142
+ }
143
+
144
+ @function contrast-text($color, $is-dark: false) {
145
+ $hue: color.channel($color, 'hue', $space: oklch);
146
+ $chroma: color.channel($color, 'chroma', $space: oklch);
147
+ $lightness: color.channel($color, 'lightness', $space: oklch);
148
+ $lightness: math.div($lightness, 100%);
149
+ $l: null;
150
+ @if ($is-dark) {
151
+ @if (is-dark-on-surface($lightness, $hue, true)) {
152
+ $l: 0.2;
153
+ } @else {
154
+ $l: 0.995;
155
+ }
156
+ } @else {
157
+ @if (is-dark-on-surface($lightness, $hue, false)) {
158
+ $l: 0.3;
159
+ } @else {
160
+ $l: 0.995;
161
+ }
162
+ }
163
+ $oklch-color: oklch($l $chroma $hue);
164
+ @return color.to-gamut($oklch-color, $space: rgb, $method: local-minde);
165
+ }
166
+
167
+ @function border-color($color, $is-dark) {
168
+ @if $is-dark {
169
+ // Dark theme: lightening the border color for contrast
170
+ @return color.adjust($color, $lightness: 9%);
171
+ } @else {
172
+ // Light theme: darkening the border color for contrast
173
+ @return color.adjust($color, $lightness: -7%);
174
+ }
175
+ }
176
+
177
+ @function light-palette-generator($color) {
178
+ $shades: (
179
+ 50: 40,
180
+ 100: 90,
181
+ 200: 160,
182
+ 300: 270,
183
+ 400: 410,
184
+ 500: 500,
185
+ 600: 590,
186
+ 700: 700,
187
+ 800: 790,
188
+ 900: 860,
189
+ 950: 1060,
190
+ );
191
+ $palette: ();
192
+ $hue: color.channel($color, 'hue', $space: oklch);
193
+ $chroma: color.channel($color, 'chroma', $space: oklch);
194
+ $lightness: color.channel($color, 'lightness', $space: oklch);
195
+ $lightness: math.div($lightness, 100%);
196
+ @each $name, $shade in $shades {
197
+ $l: null;
198
+ @if (meta.type-of($shade) == number) {
199
+ @if ($shade <= 500) {
200
+ $l: math.div((-$shade + $shade * $lightness + 500), 500);
201
+ } @else {
202
+ $l: (1 - math.div(($shade - 500), 500)) * ($lightness - 0.3) + 0.3;
203
+ }
204
+ $palette: map.set($palette, $name, $l);
205
+ }
206
+ $oklch-color: oklch((map.get($palette, $name) * 100%) $chroma $hue);
207
+ $gamut-oklch: color.to-gamut($oklch-color, $space: rgb, $method: local-minde);
208
+ @if ($name==950) {
209
+ $gamut-oklch: color.scale($gamut-oklch, $chroma: -50%, $space: oklch);
210
+ }
211
+ @if ($name==900) {
212
+ $gamut-oklch: color.scale($gamut-oklch, $chroma: -33%, $space: oklch);
213
+ }
214
+ @if ($name==800) {
215
+ $gamut-oklch: color.scale($gamut-oklch, $chroma: -8%, $space: oklch);
216
+ }
217
+ $palette: map.set($palette, $name, $gamut-oklch);
218
+ }
219
+ @return $palette;
220
+ }
221
+
222
+ @function dark-palette-generator($color) {
223
+ $shades: (
224
+ 50: 50,
225
+ 100: 100,
226
+ 200: 200,
227
+ 300: 300,
228
+ 400: 400,
229
+ 500: 500,
230
+ 600: 600,
231
+ 700: 700,
232
+ 800: 800,
233
+ 900: 900,
234
+ 950: 950,
235
+ );
236
+ $palette: ();
237
+ $hue: color.channel($color, 'hue', $space: oklch);
238
+ $chroma: color.channel($color, 'chroma', $space: oklch);
239
+ $lightness: color.channel($color, 'lightness', $space: oklch);
240
+ $lightness: math.div($lightness, 100%);
241
+ @each $name, $shade in $shades {
242
+ $l: null;
243
+ @if (meta.type-of($shade) == number) {
244
+ @if ($shade <= 700) {
245
+ $l: math.div((-$shade + $shade * $lightness + 700), 700);
246
+ } @else {
247
+ $l: (1 - math.div(($shade - 700), 700)) * ($lightness - 0.3) + 0.3;
248
+ }
249
+ $palette: map.set($palette, $name, $l);
250
+ }
251
+ $oklch-color: oklch((map.get($palette, $name) * 100%) $chroma $hue);
252
+ $gamut-oklch: color.to-gamut($oklch-color, $space: rgb, $method: local-minde);
253
+ $palette: map.set($palette, $name, $gamut-oklch);
254
+ }
255
+ @return $palette;
256
+ }
257
+
258
+ @function generate-color-ranges-variables($name, $color, $is-dark: false) {
259
+ $colors: ();
260
+ $light-shades: (50, 100, 200, 300, 400);
261
+ $dark-shades: (600, 700, 800, 900, 950);
262
+
263
+ @if $is-dark {
264
+ $palette: dark-palette-generator($color);
265
+ @each $shade, $color in $palette {
266
+ $colors: map.merge($colors, (ax-sys-color-#{$name}-#{$shade}: $color));
267
+ }
268
+ } @else {
269
+ $palette: light-palette-generator($color);
270
+ @each $shade, $color in $palette {
271
+ $colors: map.merge($colors, (ax-sys-color-#{$name}-#{$shade}: $color));
272
+ }
273
+ }
274
+
275
+ @return $colors;
276
+ }
@@ -0,0 +1,2 @@
1
+ @forward './theme-generator';
2
+ @forward './utils';
@@ -0,0 +1,7 @@
1
+ $theme-colors: (
2
+ 'primary': #3b82f6,
3
+ 'secondary': #64748b,
4
+ 'success': #22c55e,
5
+ 'warning': #f59e0b,
6
+ 'danger': #f43f5e,
7
+ ) !default;
@@ -0,0 +1 @@
1
+ $theme-looks: 'solid', 'outline', 'twotone', 'blank', 'link' !default;