beathers 5.7.3 → 5.7.6
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/.prettierrc.js +8 -8
- package/CHANGELOG +274 -267
- package/css/beathers.min.css +3 -3
- package/css/beathers.min.css.map +1 -1
- package/docs/colors.md +250 -250
- package/docs/grid-system.md +130 -130
- package/docs/shaping.md +272 -272
- package/docs/typography.md +124 -124
- package/package.json +105 -101
- package/readme.md +301 -301
- package/scripts/cli.js +0 -0
- package/scss/_variables.scss +106 -106
- package/scss/beathers.min.scss +14 -15
- package/scss/functions/_colors.scss +230 -230
- package/scss/functions/_mediaQueries.scss +136 -136
- package/scss/functions/_others.scss +79 -79
- package/scss/functions/_typographic.scss +129 -129
- package/scss/functions/_validations.scss +251 -251
- package/scss/settings/_configs.scss +270 -270
- package/scss/settings/_defaults.scss +214 -214
- package/scss/settings/_index.scss +90 -90
- package/scss/style/_button.scss +101 -101
- package/scss/style/_colors.scss +146 -146
- package/scss/style/_dialog.scss +146 -146
- package/scss/style/_glass.scss +80 -80
- package/scss/style/_grid.scss +95 -95
- package/scss/style/_loader.scss +62 -62
- package/scss/style/_resets.scss +168 -168
- package/scss/style/_shaping.scss +439 -432
- package/scss/style/_typographic.scss +345 -345
|
@@ -1,230 +1,230 @@
|
|
|
1
|
-
@use 'sass:color';
|
|
2
|
-
@use 'sass:math';
|
|
3
|
-
@use 'sass:list';
|
|
4
|
-
@use 'sass:map';
|
|
5
|
-
@use '../settings/configs' as configs;
|
|
6
|
-
@use '../settings/index' as settings;
|
|
7
|
-
@use '../variables' as vars;
|
|
8
|
-
@use '../settings/defaults' as defs;
|
|
9
|
-
@use '../functions/validations' as val;
|
|
10
|
-
|
|
11
|
-
// Definitions
|
|
12
|
-
$colors: if(vars.$colors != (), vars.$colors, defs.$colors);
|
|
13
|
-
$opacities: if(vars.$opacities != (), vars.$opacities, defs.$opacities);
|
|
14
|
-
$useColorsLightMode: if(vars.$useColorsLightMode != null, vars.$useColorsLightMode, settings.$useColorsLightMode);
|
|
15
|
-
$useColorsDarkMode: if(vars.$useColorsDarkMode != null, vars.$useColorsDarkMode, settings.$useColorsDarkMode);
|
|
16
|
-
$useColorsOpacities: if(vars.$useColorsOpacities != null, vars.$useColorsOpacities, settings.$useColorsOpacities);
|
|
17
|
-
|
|
18
|
-
// Color Convertors ----- ----- ----- -----
|
|
19
|
-
//
|
|
20
|
-
// @function hexToRgba
|
|
21
|
-
// --------------------------------------
|
|
22
|
-
// Converts a hex color value to RGBA format
|
|
23
|
-
//
|
|
24
|
-
// @param {Color} $color - The hex color to convert (e.g. '#ffffff' or '#fff')
|
|
25
|
-
// @param {Number} $opacity - Optional opacity value between 0 and 1 (default: 1)
|
|
26
|
-
// @return {Color} - The color in rgba() format
|
|
27
|
-
//
|
|
28
|
-
// @example scss
|
|
29
|
-
// color: hexToRgba('#ffffff');
|
|
30
|
-
// // Returns rgba(255, 255, 255, 1)
|
|
31
|
-
// color: hexToRgba('#ffffff', 0.5);
|
|
32
|
-
// // Returns rgba(255, 255, 255, 0.5)
|
|
33
|
-
// color: hexToRgba('#ffffff80');
|
|
34
|
-
// // Returns rgba(255, 255, 255, 0.5)
|
|
35
|
-
//
|
|
36
|
-
@function hexToRgba($color, $opacity: 1, $debugIn: null) {
|
|
37
|
-
// Validate parameters
|
|
38
|
-
$checkedColor: val.hexColor('color', $color, 'hexToRgba().#{$debugIn}');
|
|
39
|
-
$checkedOpacity: val.opacity($opacity, 'hexToRgba().#{$debugIn}');
|
|
40
|
-
|
|
41
|
-
@return rgba(
|
|
42
|
-
color.channel($checkedColor, 'red', $space: rgb),
|
|
43
|
-
color.channel($checkedColor, 'green', $space: rgb),
|
|
44
|
-
color.channel($checkedColor, 'blue', $space: rgb),
|
|
45
|
-
$checkedOpacity
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Use Color ----- ----- ----- -----
|
|
50
|
-
//
|
|
51
|
-
// @function useColor
|
|
52
|
-
// --------------------------------------
|
|
53
|
-
// Retrieves a color from any color map with optional variant and opacity
|
|
54
|
-
//
|
|
55
|
-
// @param {String} $color - The color key to retrieve from the map
|
|
56
|
-
// @param {String} $mode - Optional mode, must be 'light' or 'dark' (default: 'light')
|
|
57
|
-
// @param {Number} $opacity - Optional opacity value between 0 and 100 (default: 100)
|
|
58
|
-
// @param {Map} $map - Optional color map to use (defaults to $colors)
|
|
59
|
-
// @return {Color} - The color value, possibly with applied opacity
|
|
60
|
-
// @throws {Error} - If mode is provided but isn't 'light' or 'dark'
|
|
61
|
-
// @throws {Error} - If opacity is provided but isn't a number between 0 and 100
|
|
62
|
-
//
|
|
63
|
-
// @example scss
|
|
64
|
-
// // Using default color map ($colors)
|
|
65
|
-
// color: useColor('primary', 'light', 0.5);
|
|
66
|
-
// // Returns the light variant of primary color with 50% opacity
|
|
67
|
-
//
|
|
68
|
-
// // Using a custom color map
|
|
69
|
-
// color: useColor('secondary', 'dark', null, $customMap);
|
|
70
|
-
// // Returns the dark variant of secondary color from custom map
|
|
71
|
-
//
|
|
72
|
-
@function useColor($color, $mode: 'light', $opacity: 100) {
|
|
73
|
-
// Validate parameters
|
|
74
|
-
$checkedMode: val.colorMode($mode, 'useColor()');
|
|
75
|
-
$checkedOpacity: val.colorOpacity($opacity, 'useColor()');
|
|
76
|
-
|
|
77
|
-
@if $color {
|
|
78
|
-
$value: map.get($color, $mode);
|
|
79
|
-
|
|
80
|
-
@if $checkedOpacity {
|
|
81
|
-
@return hexToRgba($value, math.div($opacity, 100), 'useColor().#{$value}');
|
|
82
|
-
} @else {
|
|
83
|
-
@return $value;
|
|
84
|
-
}
|
|
85
|
-
} @else {
|
|
86
|
-
@return null;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
@function useColorWithMap($color, $mode: 'light', $opacity: 100, $map: $colors) {
|
|
91
|
-
// Validate parameters
|
|
92
|
-
$checkedMap: val.map($map, 'useColorWithMap().map');
|
|
93
|
-
|
|
94
|
-
$colorValue: map.get($checkedMap, $color);
|
|
95
|
-
@return useColor($colorValue, $mode, $opacity);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// @mixin useColorProperty
|
|
99
|
-
// --------------------------------------
|
|
100
|
-
// Applies color properties with theme variant support while handling light/dark themes
|
|
101
|
-
// and creating appropriate CSS selectors for different use cases.
|
|
102
|
-
//
|
|
103
|
-
// @param {String} $colorClass - The CSS class name to apply the color to (e.g., 'color-1', 'bg\:color-1')
|
|
104
|
-
// @param {String|Null} $class - The CSS class prefix (e.g., 'bg', 'border', null for 'color')
|
|
105
|
-
// @param {String} $property - The CSS property to set (e.g., 'color', 'background-color')
|
|
106
|
-
// @param {Map} $color - The color map with light/dark variants
|
|
107
|
-
// @param {Map} $map - The parent color map containing all colors
|
|
108
|
-
// @param {Number} $opacity - Optional opacity value between 0-100 (default: 100)
|
|
109
|
-
// @throws {Error} - If provided parameters fail validation through val.* functions
|
|
110
|
-
//
|
|
111
|
-
// @example scss
|
|
112
|
-
// // Apply primary color as text color with 50% opacity
|
|
113
|
-
// @include useColorProperty("color-1", null, "color", $primaryColor, $colorsMap, 50);
|
|
114
|
-
//
|
|
115
|
-
// // Apply primary color as background with full opacity
|
|
116
|
-
// @include useColorProperty("bg\:color-1", "bg", "background-color", $primaryColor, $colorsMap);
|
|
117
|
-
//
|
|
118
|
-
// Generated Selectors:
|
|
119
|
-
// Each call to this mixin generates three CSS selectors to support different theming approaches:
|
|
120
|
-
//
|
|
121
|
-
// 1. Parent/child relationship: `.light .className`, `.dark .className`
|
|
122
|
-
// For theme inheritance from parent elements
|
|
123
|
-
// Example: <div class="light"><span class="color-1">Themed text</span></div>
|
|
124
|
-
//
|
|
125
|
-
// 2. Modifier class: `.className.light`, `.className.dark`
|
|
126
|
-
// For direct theme application to the element itself
|
|
127
|
-
// Example: <span class="color-1 light">Themed text</span>
|
|
128
|
-
//
|
|
129
|
-
// 3. Prefixed class: `.light\:className`, `.dark\:className`
|
|
130
|
-
// For utility-first CSS approaches
|
|
131
|
-
// Example: <span class="light\:color-1">Themed text</span>
|
|
132
|
-
//
|
|
133
|
-
// Note: When light and dark variants are identical, a single class without theme
|
|
134
|
-
// modifiers is generated to reduce CSS output size.
|
|
135
|
-
@mixin useColorProperty($colorClass, $class, $property, $color, $map, $opacity: 100) {
|
|
136
|
-
// Validate parameters
|
|
137
|
-
$checkedClass: val.colorClass($class, 'useColorProperty().class');
|
|
138
|
-
$checkedProperty: val.colorProperty($property, 'useColorProperty().property');
|
|
139
|
-
$checkedMap: val.map($map, 'useColorProperty().map');
|
|
140
|
-
$checkedOpacity: val.colorOpacity($opacity, 'useColorProperty().opacity');
|
|
141
|
-
$checkedLight: val.mapItem($color, 'light', 'light/dark', 'useColorProperty().color');
|
|
142
|
-
$checkedDark: val.mapItem($color, 'dark', 'light/dark', 'useColorProperty().color');
|
|
143
|
-
|
|
144
|
-
$light: map.get($color, 'light');
|
|
145
|
-
$dark: map.get($color, 'dark');
|
|
146
|
-
|
|
147
|
-
$checkedLightValue: val.hexColor('#{$colorClass}.light', $light, 'root-colors()');
|
|
148
|
-
$checkedDarkValue: val.hexColor('#{$colorClass}.dark', $dark, 'root-colors()');
|
|
149
|
-
|
|
150
|
-
@if $light and $dark and $dark != $light {
|
|
151
|
-
@if ($useColorsLightMode) {
|
|
152
|
-
.light .#{$colorClass},
|
|
153
|
-
.#{$colorClass}.light,
|
|
154
|
-
.light\:#{$colorClass} {
|
|
155
|
-
#{$property}: useColor($color, 'light', $opacity);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
@if ($useColorsDarkMode) {
|
|
160
|
-
.dark .#{$colorClass},
|
|
161
|
-
.#{$colorClass}.dark,
|
|
162
|
-
.dark\:#{$colorClass} {
|
|
163
|
-
#{$property}: useColor($color, 'dark', $opacity);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
} @else {
|
|
167
|
-
.#{$colorClass} {
|
|
168
|
-
#{$property}: useColor($color, if($light, 'light', 'dark'), $opacity);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Use Colors Map ----- ----- ----- -----
|
|
174
|
-
//
|
|
175
|
-
// @mixin useColorsMap
|
|
176
|
-
// --------------------------------------
|
|
177
|
-
// Creates color utility classes using useColor() function for theme variant handling
|
|
178
|
-
// @param {Map} $map - The color map to use (e.g., $colors)
|
|
179
|
-
// @param {Boolean} $withOpacity - Whether to generate opacity variants (default: true)
|
|
180
|
-
// @throws {Error} - If $map is not a valid map
|
|
181
|
-
//
|
|
182
|
-
// @example scss
|
|
183
|
-
// @include useColorsMap($themeColors);
|
|
184
|
-
// // Creates all color classes with theme support
|
|
185
|
-
// // Generated classes include:
|
|
186
|
-
// // .color-[colorName], .bg-color-[colorName], .border-color-[colorName]
|
|
187
|
-
// // With theme variants like .light, .dark
|
|
188
|
-
// // With optional opacity variants like :50, :75
|
|
189
|
-
// // With pseudo-class variants like :hover, :focus
|
|
190
|
-
//
|
|
191
|
-
@mixin useColorsMap($map: $colors, $withOpacity: true) {
|
|
192
|
-
// Validate parameters
|
|
193
|
-
$checkedMap: val.map($map, 'useColorsMap()');
|
|
194
|
-
$checkedWithOpacity: val.boolean($withOpacity, 'useColorsMap()');
|
|
195
|
-
|
|
196
|
-
@each $color, $modes in $checkedMap {
|
|
197
|
-
@if $color {
|
|
198
|
-
@each $class, $property in configs.$colorsPropertiesMap {
|
|
199
|
-
$mainClass: if($class, '#{$class}#{\:}color-#{$color}', 'color-#{$color}');
|
|
200
|
-
|
|
201
|
-
@include useColorProperty($mainClass, $class, $property, $modes, $map);
|
|
202
|
-
|
|
203
|
-
@if $checkedWithOpacity and $useColorsOpacities {
|
|
204
|
-
@each $opacity in $opacities {
|
|
205
|
-
@include useColorProperty('#{$mainClass}#{\:}#{$opacity}', $class, $property, $modes, $map, $opacity);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
@each $pseudoClass, $pseudo in configs.$colorsPseudoMap {
|
|
210
|
-
@if $pseudoClass != 'placeholder' or ($pseudoClass == 'placeholder' and $class == null) {
|
|
211
|
-
@include useColorProperty('#{$mainClass}#{\:}#{$pseudoClass}#{$pseudo}', $class, $property, $modes, $map);
|
|
212
|
-
|
|
213
|
-
@if $checkedWithOpacity and $useColorsOpacities {
|
|
214
|
-
@each $opacity in $opacities {
|
|
215
|
-
@include useColorProperty(
|
|
216
|
-
'#{$mainClass}#{\:}#{$opacity}#{\:}#{$pseudoClass}#{$pseudo}',
|
|
217
|
-
$class,
|
|
218
|
-
$property,
|
|
219
|
-
$modes,
|
|
220
|
-
$map,
|
|
221
|
-
$opacity
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
1
|
+
@use 'sass:color';
|
|
2
|
+
@use 'sass:math';
|
|
3
|
+
@use 'sass:list';
|
|
4
|
+
@use 'sass:map';
|
|
5
|
+
@use '../settings/configs' as configs;
|
|
6
|
+
@use '../settings/index' as settings;
|
|
7
|
+
@use '../variables' as vars;
|
|
8
|
+
@use '../settings/defaults' as defs;
|
|
9
|
+
@use '../functions/validations' as val;
|
|
10
|
+
|
|
11
|
+
// Definitions
|
|
12
|
+
$colors: if(vars.$colors != (), vars.$colors, defs.$colors);
|
|
13
|
+
$opacities: if(vars.$opacities != (), vars.$opacities, defs.$opacities);
|
|
14
|
+
$useColorsLightMode: if(vars.$useColorsLightMode != null, vars.$useColorsLightMode, settings.$useColorsLightMode);
|
|
15
|
+
$useColorsDarkMode: if(vars.$useColorsDarkMode != null, vars.$useColorsDarkMode, settings.$useColorsDarkMode);
|
|
16
|
+
$useColorsOpacities: if(vars.$useColorsOpacities != null, vars.$useColorsOpacities, settings.$useColorsOpacities);
|
|
17
|
+
|
|
18
|
+
// Color Convertors ----- ----- ----- -----
|
|
19
|
+
//
|
|
20
|
+
// @function hexToRgba
|
|
21
|
+
// --------------------------------------
|
|
22
|
+
// Converts a hex color value to RGBA format
|
|
23
|
+
//
|
|
24
|
+
// @param {Color} $color - The hex color to convert (e.g. '#ffffff' or '#fff')
|
|
25
|
+
// @param {Number} $opacity - Optional opacity value between 0 and 1 (default: 1)
|
|
26
|
+
// @return {Color} - The color in rgba() format
|
|
27
|
+
//
|
|
28
|
+
// @example scss
|
|
29
|
+
// color: hexToRgba('#ffffff');
|
|
30
|
+
// // Returns rgba(255, 255, 255, 1)
|
|
31
|
+
// color: hexToRgba('#ffffff', 0.5);
|
|
32
|
+
// // Returns rgba(255, 255, 255, 0.5)
|
|
33
|
+
// color: hexToRgba('#ffffff80');
|
|
34
|
+
// // Returns rgba(255, 255, 255, 0.5)
|
|
35
|
+
//
|
|
36
|
+
@function hexToRgba($color, $opacity: 1, $debugIn: null) {
|
|
37
|
+
// Validate parameters
|
|
38
|
+
$checkedColor: val.hexColor('color', $color, 'hexToRgba().#{$debugIn}');
|
|
39
|
+
$checkedOpacity: val.opacity($opacity, 'hexToRgba().#{$debugIn}');
|
|
40
|
+
|
|
41
|
+
@return rgba(
|
|
42
|
+
color.channel($checkedColor, 'red', $space: rgb),
|
|
43
|
+
color.channel($checkedColor, 'green', $space: rgb),
|
|
44
|
+
color.channel($checkedColor, 'blue', $space: rgb),
|
|
45
|
+
$checkedOpacity
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Use Color ----- ----- ----- -----
|
|
50
|
+
//
|
|
51
|
+
// @function useColor
|
|
52
|
+
// --------------------------------------
|
|
53
|
+
// Retrieves a color from any color map with optional variant and opacity
|
|
54
|
+
//
|
|
55
|
+
// @param {String} $color - The color key to retrieve from the map
|
|
56
|
+
// @param {String} $mode - Optional mode, must be 'light' or 'dark' (default: 'light')
|
|
57
|
+
// @param {Number} $opacity - Optional opacity value between 0 and 100 (default: 100)
|
|
58
|
+
// @param {Map} $map - Optional color map to use (defaults to $colors)
|
|
59
|
+
// @return {Color} - The color value, possibly with applied opacity
|
|
60
|
+
// @throws {Error} - If mode is provided but isn't 'light' or 'dark'
|
|
61
|
+
// @throws {Error} - If opacity is provided but isn't a number between 0 and 100
|
|
62
|
+
//
|
|
63
|
+
// @example scss
|
|
64
|
+
// // Using default color map ($colors)
|
|
65
|
+
// color: useColor('primary', 'light', 0.5);
|
|
66
|
+
// // Returns the light variant of primary color with 50% opacity
|
|
67
|
+
//
|
|
68
|
+
// // Using a custom color map
|
|
69
|
+
// color: useColor('secondary', 'dark', null, $customMap);
|
|
70
|
+
// // Returns the dark variant of secondary color from custom map
|
|
71
|
+
//
|
|
72
|
+
@function useColor($color, $mode: 'light', $opacity: 100) {
|
|
73
|
+
// Validate parameters
|
|
74
|
+
$checkedMode: val.colorMode($mode, 'useColor()');
|
|
75
|
+
$checkedOpacity: val.colorOpacity($opacity, 'useColor()');
|
|
76
|
+
|
|
77
|
+
@if $color {
|
|
78
|
+
$value: map.get($color, $mode);
|
|
79
|
+
|
|
80
|
+
@if $checkedOpacity {
|
|
81
|
+
@return hexToRgba($value, math.div($opacity, 100), 'useColor().#{$value}');
|
|
82
|
+
} @else {
|
|
83
|
+
@return $value;
|
|
84
|
+
}
|
|
85
|
+
} @else {
|
|
86
|
+
@return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@function useColorWithMap($color, $mode: 'light', $opacity: 100, $map: $colors) {
|
|
91
|
+
// Validate parameters
|
|
92
|
+
$checkedMap: val.map($map, 'useColorWithMap().map');
|
|
93
|
+
|
|
94
|
+
$colorValue: map.get($checkedMap, $color);
|
|
95
|
+
@return useColor($colorValue, $mode, $opacity);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// @mixin useColorProperty
|
|
99
|
+
// --------------------------------------
|
|
100
|
+
// Applies color properties with theme variant support while handling light/dark themes
|
|
101
|
+
// and creating appropriate CSS selectors for different use cases.
|
|
102
|
+
//
|
|
103
|
+
// @param {String} $colorClass - The CSS class name to apply the color to (e.g., 'color-1', 'bg\:color-1')
|
|
104
|
+
// @param {String|Null} $class - The CSS class prefix (e.g., 'bg', 'border', null for 'color')
|
|
105
|
+
// @param {String} $property - The CSS property to set (e.g., 'color', 'background-color')
|
|
106
|
+
// @param {Map} $color - The color map with light/dark variants
|
|
107
|
+
// @param {Map} $map - The parent color map containing all colors
|
|
108
|
+
// @param {Number} $opacity - Optional opacity value between 0-100 (default: 100)
|
|
109
|
+
// @throws {Error} - If provided parameters fail validation through val.* functions
|
|
110
|
+
//
|
|
111
|
+
// @example scss
|
|
112
|
+
// // Apply primary color as text color with 50% opacity
|
|
113
|
+
// @include useColorProperty("color-1", null, "color", $primaryColor, $colorsMap, 50);
|
|
114
|
+
//
|
|
115
|
+
// // Apply primary color as background with full opacity
|
|
116
|
+
// @include useColorProperty("bg\:color-1", "bg", "background-color", $primaryColor, $colorsMap);
|
|
117
|
+
//
|
|
118
|
+
// Generated Selectors:
|
|
119
|
+
// Each call to this mixin generates three CSS selectors to support different theming approaches:
|
|
120
|
+
//
|
|
121
|
+
// 1. Parent/child relationship: `.light .className`, `.dark .className`
|
|
122
|
+
// For theme inheritance from parent elements
|
|
123
|
+
// Example: <div class="light"><span class="color-1">Themed text</span></div>
|
|
124
|
+
//
|
|
125
|
+
// 2. Modifier class: `.className.light`, `.className.dark`
|
|
126
|
+
// For direct theme application to the element itself
|
|
127
|
+
// Example: <span class="color-1 light">Themed text</span>
|
|
128
|
+
//
|
|
129
|
+
// 3. Prefixed class: `.light\:className`, `.dark\:className`
|
|
130
|
+
// For utility-first CSS approaches
|
|
131
|
+
// Example: <span class="light\:color-1">Themed text</span>
|
|
132
|
+
//
|
|
133
|
+
// Note: When light and dark variants are identical, a single class without theme
|
|
134
|
+
// modifiers is generated to reduce CSS output size.
|
|
135
|
+
@mixin useColorProperty($colorClass, $class, $property, $color, $map, $opacity: 100) {
|
|
136
|
+
// Validate parameters
|
|
137
|
+
$checkedClass: val.colorClass($class, 'useColorProperty().class');
|
|
138
|
+
$checkedProperty: val.colorProperty($property, 'useColorProperty().property');
|
|
139
|
+
$checkedMap: val.map($map, 'useColorProperty().map');
|
|
140
|
+
$checkedOpacity: val.colorOpacity($opacity, 'useColorProperty().opacity');
|
|
141
|
+
$checkedLight: val.mapItem($color, 'light', 'light/dark', 'useColorProperty().color');
|
|
142
|
+
$checkedDark: val.mapItem($color, 'dark', 'light/dark', 'useColorProperty().color');
|
|
143
|
+
|
|
144
|
+
$light: map.get($color, 'light');
|
|
145
|
+
$dark: map.get($color, 'dark');
|
|
146
|
+
|
|
147
|
+
$checkedLightValue: val.hexColor('#{$colorClass}.light', $light, 'root-colors()');
|
|
148
|
+
$checkedDarkValue: val.hexColor('#{$colorClass}.dark', $dark, 'root-colors()');
|
|
149
|
+
|
|
150
|
+
@if $light and $dark and $dark != $light {
|
|
151
|
+
@if ($useColorsLightMode) {
|
|
152
|
+
.light .#{$colorClass},
|
|
153
|
+
.#{$colorClass}.light,
|
|
154
|
+
.light\:#{$colorClass} {
|
|
155
|
+
#{$property}: useColor($color, 'light', $opacity);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@if ($useColorsDarkMode) {
|
|
160
|
+
.dark .#{$colorClass},
|
|
161
|
+
.#{$colorClass}.dark,
|
|
162
|
+
.dark\:#{$colorClass} {
|
|
163
|
+
#{$property}: useColor($color, 'dark', $opacity);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
} @else {
|
|
167
|
+
.#{$colorClass} {
|
|
168
|
+
#{$property}: useColor($color, if($light, 'light', 'dark'), $opacity);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Use Colors Map ----- ----- ----- -----
|
|
174
|
+
//
|
|
175
|
+
// @mixin useColorsMap
|
|
176
|
+
// --------------------------------------
|
|
177
|
+
// Creates color utility classes using useColor() function for theme variant handling
|
|
178
|
+
// @param {Map} $map - The color map to use (e.g., $colors)
|
|
179
|
+
// @param {Boolean} $withOpacity - Whether to generate opacity variants (default: true)
|
|
180
|
+
// @throws {Error} - If $map is not a valid map
|
|
181
|
+
//
|
|
182
|
+
// @example scss
|
|
183
|
+
// @include useColorsMap($themeColors);
|
|
184
|
+
// // Creates all color classes with theme support
|
|
185
|
+
// // Generated classes include:
|
|
186
|
+
// // .color-[colorName], .bg-color-[colorName], .border-color-[colorName]
|
|
187
|
+
// // With theme variants like .light, .dark
|
|
188
|
+
// // With optional opacity variants like :50, :75
|
|
189
|
+
// // With pseudo-class variants like :hover, :focus
|
|
190
|
+
//
|
|
191
|
+
@mixin useColorsMap($map: $colors, $withOpacity: true) {
|
|
192
|
+
// Validate parameters
|
|
193
|
+
$checkedMap: val.map($map, 'useColorsMap()');
|
|
194
|
+
$checkedWithOpacity: val.boolean($withOpacity, 'useColorsMap()');
|
|
195
|
+
|
|
196
|
+
@each $color, $modes in $checkedMap {
|
|
197
|
+
@if $color {
|
|
198
|
+
@each $class, $property in configs.$colorsPropertiesMap {
|
|
199
|
+
$mainClass: if($class, '#{$class}#{\:}color-#{$color}', 'color-#{$color}');
|
|
200
|
+
|
|
201
|
+
@include useColorProperty($mainClass, $class, $property, $modes, $map);
|
|
202
|
+
|
|
203
|
+
@if $checkedWithOpacity and $useColorsOpacities {
|
|
204
|
+
@each $opacity in $opacities {
|
|
205
|
+
@include useColorProperty('#{$mainClass}#{\:}#{$opacity}', $class, $property, $modes, $map, $opacity);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@each $pseudoClass, $pseudo in configs.$colorsPseudoMap {
|
|
210
|
+
@if $pseudoClass != 'placeholder' or ($pseudoClass == 'placeholder' and $class == null) {
|
|
211
|
+
@include useColorProperty('#{$mainClass}#{\:}#{$pseudoClass}#{$pseudo}', $class, $property, $modes, $map);
|
|
212
|
+
|
|
213
|
+
@if $checkedWithOpacity and $useColorsOpacities {
|
|
214
|
+
@each $opacity in $opacities {
|
|
215
|
+
@include useColorProperty(
|
|
216
|
+
'#{$mainClass}#{\:}#{$opacity}#{\:}#{$pseudoClass}#{$pseudo}',
|
|
217
|
+
$class,
|
|
218
|
+
$property,
|
|
219
|
+
$modes,
|
|
220
|
+
$map,
|
|
221
|
+
$opacity
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|