@acorex/styles 21.0.0-next.5 → 21.0.0-next.7
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/components/{_action-item.scss → _action-item.css} +19 -27
- package/components/{_actionsheet.scss → _actionsheet.css} +10 -3
- package/components/{_check-box.scss → _check-box.css} +8 -17
- package/components/{_drop-down.scss → _drop-down.css} +27 -15
- package/components/_editor-container.css +306 -0
- package/components/{_list.scss → _list.css} +82 -42
- package/components/{_radio.scss → _radio.css} +16 -18
- package/components/{_table.scss → _table.css} +62 -19
- package/components/{_uploader.scss → _uploader.css} +13 -6
- package/components/index.css +11 -0
- package/icons/fontawesome/_variables.css +229 -0
- package/icons/fontawesome/index.css +555 -0
- package/icons/huge/huge-bulk/_variables.css +211 -0
- package/icons/huge/huge-bulk/index.css +520 -0
- package/icons/huge/huge-duotone/_variables.css +211 -0
- package/icons/huge/huge-duotone/index.css +517 -0
- package/icons/huge/huge-solid-rounded/_variables.css +211 -0
- package/icons/huge/huge-solid-rounded/index.css +504 -0
- package/icons/huge/huge-solid-sharp/_variables.css +213 -0
- package/icons/huge/huge-solid-sharp/index.css +517 -0
- package/icons/huge/huge-solid-standard/_variables.css +211 -0
- package/icons/huge/huge-solid-standard/index.css +516 -0
- package/icons/huge/huge-stroke-rounded/_variables.css +211 -0
- package/icons/huge/huge-stroke-rounded/index.css +515 -0
- package/icons/huge/huge-stroke-sharp/_variables.css +142 -0
- package/icons/huge/huge-stroke-sharp/index.css +515 -0
- package/icons/huge/huge-stroke-standard/_variables.css +141 -0
- package/icons/huge/huge-stroke-standard/index.css +515 -0
- package/icons/huge/huge-twotone/_variables.css +211 -0
- package/icons/huge/huge-twotone/index.css +516 -0
- package/icons/material/_variables.css +229 -0
- package/icons/material/index.css +573 -0
- package/index.css +25 -0
- package/package.json +1 -1
- package/tailwind-base.js +0 -4
- package/themes/{default.scss → default copy.scss } +6 -9
- package/themes/default.css +973 -0
- package/base/_preflight.scss +0 -424
- package/base/index.scss +0 -15
- package/components/_editor-container.scss +0 -293
- package/components/index.scss +0 -11
- package/generators/index.js +0 -1
- package/generators/tailwind-class-generator.js +0 -68
- package/icons/fontawesome/_variables.scss +0 -225
- package/icons/fontawesome/index.scss +0 -705
- package/icons/huge/huge-bulk/_variables.scss +0 -209
- package/icons/huge/huge-bulk/index.scss +0 -656
- package/icons/huge/huge-duotone/_variables.scss +0 -209
- package/icons/huge/huge-duotone/index.scss +0 -657
- package/icons/huge/huge-solid-rounded/_variables.scss +0 -209
- package/icons/huge/huge-solid-rounded/index.scss +0 -643
- package/icons/huge/huge-solid-sharp/_variables.scss +0 -209
- package/icons/huge/huge-solid-sharp/index.scss +0 -656
- package/icons/huge/huge-solid-standard/_variables.scss +0 -209
- package/icons/huge/huge-solid-standard/index.scss +0 -656
- package/icons/huge/huge-stroke-rounded/_variables.scss +0 -209
- package/icons/huge/huge-stroke-rounded/index.scss +0 -656
- package/icons/huge/huge-stroke-sharp/_variables.scss +0 -209
- package/icons/huge/huge-stroke-sharp/index.scss +0 -656
- package/icons/huge/huge-stroke-standard/_variables.scss +0 -209
- package/icons/huge/huge-stroke-standard/index.scss +0 -656
- package/icons/huge/huge-twotone/_variables.scss +0 -209
- package/icons/huge/huge-twotone/index.scss +0 -656
- package/icons/material/_variables.scss +0 -224
- package/icons/material/index.scss +0 -709
- package/index.scss +0 -7
- package/mixins/_editor-looks.scss +0 -32
- package/mixins/_media.scss +0 -73
- package/mixins/_scroll-bar.scss +0 -35
- package/mixins/_util.scss +0 -19
- package/mixins/index.scss +0 -4
- package/utils/_theme-generator.scss +0 -238
- package/utils/_utils.scss +0 -278
- package/utils/index.scss +0 -2
- /package/components/{_general-button.scss → _general-button.css} +0 -0
- /package/components/{_ripple.scss → _ripple.css} +0 -0
package/mixins/_media.scss
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
@mixin media($media) {
|
2
|
-
// phone -> xs
|
3
|
-
@if $media == 'xs' {
|
4
|
-
@media (min-width: 320px) and (max-width: 640px) {
|
5
|
-
@content;
|
6
|
-
}
|
7
|
-
}
|
8
|
-
|
9
|
-
// tablet -> md
|
10
|
-
@if $media == 'md' {
|
11
|
-
@media (min-width: 768px) {
|
12
|
-
@content;
|
13
|
-
}
|
14
|
-
}
|
15
|
-
|
16
|
-
// tablet-landscape -> lg
|
17
|
-
@if $media == 'lg' {
|
18
|
-
@media (min-width: 1024px) {
|
19
|
-
@content;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
|
23
|
-
// desktop -> xl
|
24
|
-
@if $media == 'xl' {
|
25
|
-
@media (min-width: 1280px) {
|
26
|
-
@content;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
// desktop-large -> 2xl
|
31
|
-
@if $media == '2xl' {
|
32
|
-
@media (min-width: 1536px) {
|
33
|
-
@content;
|
34
|
-
}
|
35
|
-
}
|
36
|
-
}
|
37
|
-
|
38
|
-
@mixin mediaLessThan($media) {
|
39
|
-
// phone -> xs
|
40
|
-
@if $media == 'xs' {
|
41
|
-
@media screen and (max-width: 640px) {
|
42
|
-
@content;
|
43
|
-
}
|
44
|
-
}
|
45
|
-
|
46
|
-
// tablet -> md
|
47
|
-
@if $media == 'md' {
|
48
|
-
@media screen and (max-width: 768px) {
|
49
|
-
@content;
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
// tablet-landscape -> lg
|
54
|
-
@if $media == 'lg' {
|
55
|
-
@media screen and (max-width: 1024px) {
|
56
|
-
@content;
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
// desktop -> xl
|
61
|
-
@if $media == 'xl' {
|
62
|
-
@media screen and (max-width: 1280px) {
|
63
|
-
@content;
|
64
|
-
}
|
65
|
-
}
|
66
|
-
|
67
|
-
// desktop-large -> 2xl
|
68
|
-
@if $media == '2xl' {
|
69
|
-
@media screen and (max-width: 1536px) {
|
70
|
-
@content;
|
71
|
-
}
|
72
|
-
}
|
73
|
-
}
|
package/mixins/_scroll-bar.scss
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
@mixin scroll-bar() {
|
2
|
-
:root,
|
3
|
-
* {
|
4
|
-
--ax-sys-scroller-size: 5px;
|
5
|
-
--ax-sys-scroller-size-radius: 3px;
|
6
|
-
--ax-sys-scroller-track-color: rgba(var(--ax-sys-color-light-surface));
|
7
|
-
--ax-sys-scroller-thumb-color: rgba(var(--ax-sys-color-darkest-surface));
|
8
|
-
scrollbar-width: thin;
|
9
|
-
scrollbar-color: var(--ax-sys-scroller-thumb-color) var(--ax-sys-scroller-track-color);
|
10
|
-
}
|
11
|
-
|
12
|
-
.ax-dark,
|
13
|
-
.ax-dark * {
|
14
|
-
--ax-sys-scroller-size: 5px;
|
15
|
-
--ax-sys-scroller-size-radius: 3px;
|
16
|
-
--ax-sys-scroller-track-color: rgba(var(--ax-sys-color-darker-surface));
|
17
|
-
--ax-sys-scroller-thumb-color: rgba(var(--ax-sys-color-lightest-surface));
|
18
|
-
scrollbar-color: var(--ax-sys-scroller-thumb-color) var(--ax-sys-scroller-track-color);
|
19
|
-
}
|
20
|
-
|
21
|
-
::-webkit-scrollbar {
|
22
|
-
width: var(--ax-sys-scroller-size);
|
23
|
-
height: var(--ax-sys-scroller-size);
|
24
|
-
}
|
25
|
-
|
26
|
-
::-webkit-scrollbar-track {
|
27
|
-
background: var(--ax-sys-scroller-track-color);
|
28
|
-
border-radius: var(--ax-sys-scroller-size-radius);
|
29
|
-
}
|
30
|
-
|
31
|
-
::-webkit-scrollbar-thumb {
|
32
|
-
background: var(--ax-sys-scroller-thumb-color);
|
33
|
-
border-radius: var(--ax-sys-scroller-size-radius);
|
34
|
-
}
|
35
|
-
}
|
package/mixins/_util.scss
DELETED
package/mixins/index.scss
DELETED
@@ -1,238 +0,0 @@
|
|
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-palette-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 $color != null {
|
188
|
-
@if (meta.type-of($color) == list) {
|
189
|
-
$color: list.nth($color, 1);
|
190
|
-
}
|
191
|
-
@include convert-to-rgb(generate-color-ranges-variables($name, $color, false));
|
192
|
-
}
|
193
|
-
}
|
194
|
-
}
|
195
|
-
// Generate Colored Surfaces
|
196
|
-
@each $name, $color in $colors {
|
197
|
-
@if $color != null {
|
198
|
-
@if (meta.type-of($color) == list) {
|
199
|
-
$color: list.nth($color, 1);
|
200
|
-
}
|
201
|
-
@include convert-to-rgb(generate-named-surfaces-variables($name, $color, false));
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
|
206
|
-
/************** Dark Palette **************/
|
207
|
-
$options: map.deep-merge(
|
208
|
-
$options,
|
209
|
-
(
|
210
|
-
'is-dark': true,
|
211
|
-
)
|
212
|
-
);
|
213
|
-
.ax-dark {
|
214
|
-
// Generate Base Surfaces
|
215
|
-
@include convert-to-rgb(generate-surfaces-colors-variables($theme-surfaces, $options));
|
216
|
-
// Generate Ranges
|
217
|
-
@if $generate-color-range {
|
218
|
-
/* Ranges */
|
219
|
-
@each $name, $color in $colors {
|
220
|
-
@if $color != null {
|
221
|
-
@if (meta.type-of($color) == list) {
|
222
|
-
$color: list.nth($color, 2);
|
223
|
-
}
|
224
|
-
@include convert-to-rgb(generate-color-ranges-variables($name, $color, true));
|
225
|
-
}
|
226
|
-
}
|
227
|
-
}
|
228
|
-
// Generate Colored Surfaces
|
229
|
-
@each $name, $color in $colors {
|
230
|
-
@if $color != null {
|
231
|
-
@if (meta.type-of($color) == list) {
|
232
|
-
$color: list.nth($color, 2);
|
233
|
-
}
|
234
|
-
@include convert-to-rgb(generate-named-surfaces-variables($name, $color, true));
|
235
|
-
}
|
236
|
-
}
|
237
|
-
}
|
238
|
-
}
|
package/utils/_utils.scss
DELETED
@@ -1,278 +0,0 @@
|
|
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
|
-
@if ($color) {
|
197
|
-
@each $name, $shade in $shades {
|
198
|
-
$l: null;
|
199
|
-
@if (meta.type-of($shade) == number) {
|
200
|
-
@if ($shade <= 500) {
|
201
|
-
$l: math.div((-$shade + $shade * $lightness + 500), 500);
|
202
|
-
} @else {
|
203
|
-
$l: (1 - math.div(($shade - 500), 500)) * ($lightness - 0.3) + 0.3;
|
204
|
-
}
|
205
|
-
$palette: map.set($palette, $name, $l);
|
206
|
-
}
|
207
|
-
$oklch-color: oklch((map.get($palette, $name) * 100%) $chroma $hue);
|
208
|
-
$gamut-oklch: color.to-gamut($oklch-color, $space: rgb, $method: local-minde);
|
209
|
-
@if ($name==950) {
|
210
|
-
$gamut-oklch: color.scale($gamut-oklch, $chroma: -50%, $space: oklch);
|
211
|
-
}
|
212
|
-
@if ($name==900) {
|
213
|
-
$gamut-oklch: color.scale($gamut-oklch, $chroma: -33%, $space: oklch);
|
214
|
-
}
|
215
|
-
@if ($name==800) {
|
216
|
-
$gamut-oklch: color.scale($gamut-oklch, $chroma: -8%, $space: oklch);
|
217
|
-
}
|
218
|
-
$palette: map.set($palette, $name, $gamut-oklch);
|
219
|
-
}
|
220
|
-
}
|
221
|
-
@return $palette;
|
222
|
-
}
|
223
|
-
|
224
|
-
@function dark-palette-generator($color) {
|
225
|
-
$shades: (
|
226
|
-
50: 50,
|
227
|
-
100: 100,
|
228
|
-
200: 200,
|
229
|
-
300: 300,
|
230
|
-
400: 400,
|
231
|
-
500: 500,
|
232
|
-
600: 600,
|
233
|
-
700: 700,
|
234
|
-
800: 800,
|
235
|
-
900: 900,
|
236
|
-
950: 950,
|
237
|
-
);
|
238
|
-
$palette: ();
|
239
|
-
$hue: color.channel($color, 'hue', $space: oklch);
|
240
|
-
$chroma: color.channel($color, 'chroma', $space: oklch);
|
241
|
-
$lightness: color.channel($color, 'lightness', $space: oklch);
|
242
|
-
$lightness: math.div($lightness, 100%);
|
243
|
-
@each $name, $shade in $shades {
|
244
|
-
$l: null;
|
245
|
-
@if (meta.type-of($shade) == number) {
|
246
|
-
@if ($shade <= 700) {
|
247
|
-
$l: math.div((-$shade + $shade * $lightness + 700), 700);
|
248
|
-
} @else {
|
249
|
-
$l: (1 - math.div(($shade - 700), 700)) * ($lightness - 0.3) + 0.3;
|
250
|
-
}
|
251
|
-
$palette: map.set($palette, $name, $l);
|
252
|
-
}
|
253
|
-
$oklch-color: oklch((map.get($palette, $name) * 100%) $chroma $hue);
|
254
|
-
$gamut-oklch: color.to-gamut($oklch-color, $space: rgb, $method: local-minde);
|
255
|
-
$palette: map.set($palette, $name, $gamut-oklch);
|
256
|
-
}
|
257
|
-
@return $palette;
|
258
|
-
}
|
259
|
-
|
260
|
-
@function generate-color-ranges-variables($name, $color, $is-dark: false) {
|
261
|
-
$colors: ();
|
262
|
-
$light-shades: (50, 100, 200, 300, 400);
|
263
|
-
$dark-shades: (600, 700, 800, 900, 950);
|
264
|
-
@if ($color) {
|
265
|
-
@if $is-dark {
|
266
|
-
$palette: dark-palette-generator($color);
|
267
|
-
@each $shade, $color in $palette {
|
268
|
-
$colors: map.merge($colors, (ax-sys-color-#{$name}-#{$shade}: $color));
|
269
|
-
}
|
270
|
-
} @else {
|
271
|
-
$palette: light-palette-generator($color);
|
272
|
-
@each $shade, $color in $palette {
|
273
|
-
$colors: map.merge($colors, (ax-sys-color-#{$name}-#{$shade}: $color));
|
274
|
-
}
|
275
|
-
}
|
276
|
-
}
|
277
|
-
@return $colors;
|
278
|
-
}
|
package/utils/index.scss
DELETED
File without changes
|
File without changes
|