beathers 5.7.2 → 5.7.5
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.
Potentially problematic release.
This version of beathers might be problematic. Click here for more details.
- 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/scripts/helpers/Merge.d.ts.map +1 -1
- package/scripts/helpers/Merge.js +4 -3
- package/scss/_variables.scss +106 -106
- package/scss/beathers.min.scss +15 -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
package/scss/style/_button.scss
CHANGED
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
$corners: (
|
|
2
|
-
'rounded': 0.25rem,
|
|
3
|
-
'circle': 100vw,
|
|
4
|
-
'sharp': 0,
|
|
5
|
-
) !default;
|
|
6
|
-
|
|
7
|
-
button {
|
|
8
|
-
cursor: pointer;
|
|
9
|
-
background: transparent;
|
|
10
|
-
border: none;
|
|
11
|
-
|
|
12
|
-
&.btn {
|
|
13
|
-
position: relative;
|
|
14
|
-
isolation: isolate;
|
|
15
|
-
appearance: none;
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-wrap: nowrap;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
transition: 250ms ease-in-out;
|
|
20
|
-
|
|
21
|
-
&:not([class*='justify-content:']) {
|
|
22
|
-
justify-content: center;
|
|
23
|
-
}
|
|
24
|
-
&:not([class*='align-items:']) {
|
|
25
|
-
align-items: center;
|
|
26
|
-
}
|
|
27
|
-
&:not([class*='text-start'], [class*='text-left'], [class*='text-end'], [class*='text-right']) {
|
|
28
|
-
text-align: center;
|
|
29
|
-
}
|
|
30
|
-
&:not([class*='border:']) {
|
|
31
|
-
border-width: 0.15em;
|
|
32
|
-
border-style: solid;
|
|
33
|
-
}
|
|
34
|
-
&:not([class*='bg:']) {
|
|
35
|
-
background-color: unset;
|
|
36
|
-
}
|
|
37
|
-
&:not([class*='radius:']) {
|
|
38
|
-
@each $corner, $value in $corners {
|
|
39
|
-
&.btn-#{$corner} {
|
|
40
|
-
border-radius: $value;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
&:is(.btn-circle) {
|
|
45
|
-
aspect-ratio: 1;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
&:is([disabled]) {
|
|
50
|
-
cursor: not-allowed;
|
|
51
|
-
opacity: 0.7;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
&::before {
|
|
55
|
-
content: '';
|
|
56
|
-
position: absolute;
|
|
57
|
-
inset: 0;
|
|
58
|
-
border-radius: inherit;
|
|
59
|
-
pointer-events: none;
|
|
60
|
-
z-index: -1;
|
|
61
|
-
transition: 250ms ease-in-out;
|
|
62
|
-
opacity: 0;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&:is(.loading) .loader-icon {
|
|
66
|
-
animation: rotate 4s ease-in-out infinite;
|
|
67
|
-
|
|
68
|
-
@keyframes rotate {
|
|
69
|
-
0% {
|
|
70
|
-
transform: rotate(0deg);
|
|
71
|
-
}
|
|
72
|
-
100% {
|
|
73
|
-
transform: rotate(360deg);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
&:is(:focus-visible, :hover) {
|
|
79
|
-
transform: translateY(-0.1em);
|
|
80
|
-
|
|
81
|
-
&:is(.text-variant) {
|
|
82
|
-
text-shadow: 0 0.05em rgba(0, 0, 0, 0.4);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&:not(.text-variant) {
|
|
86
|
-
box-shadow: 0 0.15em 0.15em rgba(0, 0, 0, 0.4);
|
|
87
|
-
|
|
88
|
-
&::before {
|
|
89
|
-
background-color: rgba(0, 0, 0, 0.15);
|
|
90
|
-
opacity: 1;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
:focus,
|
|
98
|
-
button:focus {
|
|
99
|
-
outline: unset;
|
|
100
|
-
box-shadow: unset;
|
|
101
|
-
}
|
|
1
|
+
$corners: (
|
|
2
|
+
'rounded': 0.25rem,
|
|
3
|
+
'circle': 100vw,
|
|
4
|
+
'sharp': 0,
|
|
5
|
+
) !default;
|
|
6
|
+
|
|
7
|
+
button {
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
background: transparent;
|
|
10
|
+
border: none;
|
|
11
|
+
|
|
12
|
+
&.btn {
|
|
13
|
+
position: relative;
|
|
14
|
+
isolation: isolate;
|
|
15
|
+
appearance: none;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-wrap: nowrap;
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
transition: 250ms ease-in-out;
|
|
20
|
+
|
|
21
|
+
&:not([class*='justify-content:']) {
|
|
22
|
+
justify-content: center;
|
|
23
|
+
}
|
|
24
|
+
&:not([class*='align-items:']) {
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
&:not([class*='text-start'], [class*='text-left'], [class*='text-end'], [class*='text-right']) {
|
|
28
|
+
text-align: center;
|
|
29
|
+
}
|
|
30
|
+
&:not([class*='border:']) {
|
|
31
|
+
border-width: 0.15em;
|
|
32
|
+
border-style: solid;
|
|
33
|
+
}
|
|
34
|
+
&:not([class*='bg:']) {
|
|
35
|
+
background-color: unset;
|
|
36
|
+
}
|
|
37
|
+
&:not([class*='radius:']) {
|
|
38
|
+
@each $corner, $value in $corners {
|
|
39
|
+
&.btn-#{$corner} {
|
|
40
|
+
border-radius: $value;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&:is(.btn-circle) {
|
|
45
|
+
aspect-ratio: 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&:is([disabled]) {
|
|
50
|
+
cursor: not-allowed;
|
|
51
|
+
opacity: 0.7;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&::before {
|
|
55
|
+
content: '';
|
|
56
|
+
position: absolute;
|
|
57
|
+
inset: 0;
|
|
58
|
+
border-radius: inherit;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
z-index: -1;
|
|
61
|
+
transition: 250ms ease-in-out;
|
|
62
|
+
opacity: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:is(.loading) .loader-icon {
|
|
66
|
+
animation: rotate 4s ease-in-out infinite;
|
|
67
|
+
|
|
68
|
+
@keyframes rotate {
|
|
69
|
+
0% {
|
|
70
|
+
transform: rotate(0deg);
|
|
71
|
+
}
|
|
72
|
+
100% {
|
|
73
|
+
transform: rotate(360deg);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&:is(:focus-visible, :hover) {
|
|
79
|
+
transform: translateY(-0.1em);
|
|
80
|
+
|
|
81
|
+
&:is(.text-variant) {
|
|
82
|
+
text-shadow: 0 0.05em rgba(0, 0, 0, 0.4);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:not(.text-variant) {
|
|
86
|
+
box-shadow: 0 0.15em 0.15em rgba(0, 0, 0, 0.4);
|
|
87
|
+
|
|
88
|
+
&::before {
|
|
89
|
+
background-color: rgba(0, 0, 0, 0.15);
|
|
90
|
+
opacity: 1;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:focus,
|
|
98
|
+
button:focus {
|
|
99
|
+
outline: unset;
|
|
100
|
+
box-shadow: unset;
|
|
101
|
+
}
|
package/scss/style/_colors.scss
CHANGED
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
@use 'sass:map';
|
|
2
|
-
@use '../variables' as vars;
|
|
3
|
-
@use '../settings/defaults' as defs;
|
|
4
|
-
@use '../functions/validations' as val;
|
|
5
|
-
@use '../settings/configs' as configs;
|
|
6
|
-
@use '../functions/colors' as colors;
|
|
7
|
-
@use '../settings/index' as settings;
|
|
8
|
-
|
|
9
|
-
// Definitions
|
|
10
|
-
$useColors: if(vars.$useColors != null, vars.$useColors, settings.$useColors);
|
|
11
|
-
$colors: if(vars.$colors != (), vars.$colors, defs.$colors);
|
|
12
|
-
$useCurrentColors: if(vars.$useCurrentColors != null, vars.$useCurrentColors, settings.$useCurrentColors);
|
|
13
|
-
$useRootColors: if(vars.$useRootColors != null, vars.$useRootColors, settings.$useRootColors);
|
|
14
|
-
|
|
15
|
-
// Colors System Module
|
|
16
|
-
// --------------------------
|
|
17
|
-
// This file is responsible for generating color utility classes and CSS variables
|
|
18
|
-
// based on the color maps defined in the variables file.
|
|
19
|
-
//
|
|
20
|
-
// Key features:
|
|
21
|
-
// 1. Generates color utility classes from the main colors map
|
|
22
|
-
// 2. Creates currentColor utility classes
|
|
23
|
-
// 3. Sets up CSS variables for all defined colors
|
|
24
|
-
//
|
|
25
|
-
// The color system supports:
|
|
26
|
-
// - Light and dark mode theming
|
|
27
|
-
// - Opacity variations
|
|
28
|
-
// - Pseudo-class variants (:hover, :focus, etc.)
|
|
29
|
-
//
|
|
30
|
-
// @requires ../functions/colors.scss - For color utility functions and mixins
|
|
31
|
-
// @requires ../settings/configs.scss - For configuration variables
|
|
32
|
-
// @requires ../functions/validations.scss - For validation utilities
|
|
33
|
-
// @requires ../variables.scss - For color definitions
|
|
34
|
-
|
|
35
|
-
@if $useColors {
|
|
36
|
-
// Color Utility Classes
|
|
37
|
-
// --------------------
|
|
38
|
-
// Generate color utility classes from the main colors map.
|
|
39
|
-
// Uses the useColorsMap mixin from colors functions to create a comprehensive
|
|
40
|
-
// set of color utilities for all the colors defined in $colors.
|
|
41
|
-
//
|
|
42
|
-
// Generated classes include:
|
|
43
|
-
// - .color-[colorName] - Sets text color
|
|
44
|
-
// - .bg-color-[colorName] - Sets background color
|
|
45
|
-
// - .border-color-[colorName] - Sets border color
|
|
46
|
-
//
|
|
47
|
-
// With light/dark theme variants:
|
|
48
|
-
// - Automatically applies correct color based on .light/.dark context
|
|
49
|
-
// - Supports direct class application with .color-[colorName].light
|
|
50
|
-
//
|
|
51
|
-
// With opacity variants (e.g., :50 for 50% opacity):
|
|
52
|
-
// - .color-[colorName]:50
|
|
53
|
-
// - .bg-color-[colorName]:75
|
|
54
|
-
//
|
|
55
|
-
// With pseudo-class variants:
|
|
56
|
-
// - .color-[colorName]:hover
|
|
57
|
-
// - .bg-color-[colorName]:focus
|
|
58
|
-
@include colors.useColorsMap;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
@if $useCurrentColors {
|
|
62
|
-
// CurrentColor Utility Classes
|
|
63
|
-
// ----------------------------
|
|
64
|
-
// Creates utility classes for applying the CSS `currentColor` value to various CSS properties
|
|
65
|
-
// as defined in the configs.$colorsPropertiesMap.
|
|
66
|
-
//
|
|
67
|
-
// For each property in the map (color, background-color, border-color, etc.):
|
|
68
|
-
// - Creates a base class (.{property}-current-color)
|
|
69
|
-
// - Creates pseudo-class variants for interaction states
|
|
70
|
-
//
|
|
71
|
-
// Examples:
|
|
72
|
-
// - .current-color { color: currentColor; }
|
|
73
|
-
// - .bg-current-color { background-color: currentColor; }
|
|
74
|
-
// - .border-current-color { border-color: currentColor; }
|
|
75
|
-
// - .current-color\:hover:hover { color: currentColor; }
|
|
76
|
-
// - .bg-current-color\:focus:focus { background-color: currentColor; }
|
|
77
|
-
//
|
|
78
|
-
// Usage:
|
|
79
|
-
// <div class="current-color bg-current-color:hover">
|
|
80
|
-
// This text uses currentColor and background changes to currentColor on hover
|
|
81
|
-
// </div>
|
|
82
|
-
@each $class, $property in configs.$colorsPropertiesMap {
|
|
83
|
-
$mainClass: if($class, '#{$class}#{\:}current-color', 'current-color');
|
|
84
|
-
|
|
85
|
-
.#{$mainClass} {
|
|
86
|
-
#{$property}: currentColor;
|
|
87
|
-
|
|
88
|
-
@each $pseudoClass, $pseudo in configs.$colorsPseudoMap {
|
|
89
|
-
@if $pseudoClass != 'placeholder' or ($pseudoClass == 'placeholder' and $class == null) {
|
|
90
|
-
&#{\:}#{$pseudoClass}#{$pseudo} {
|
|
91
|
-
#{$property}: currentColor;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@if $useRootColors {
|
|
100
|
-
// CSS Color Variables
|
|
101
|
-
// ------------------
|
|
102
|
-
// Generates CSS custom properties (variables) for all colors in the $colors map.
|
|
103
|
-
// These variables can be used throughout the application to ensure color consistency.
|
|
104
|
-
//
|
|
105
|
-
// The implementation:
|
|
106
|
-
// 1. Iterates through each color in the $colors map
|
|
107
|
-
// 2. Validates the color values through val.mapItem and val.hexColor functions
|
|
108
|
-
// 3. Determines if light and dark variants are the same
|
|
109
|
-
// 4. Creates appropriate CSS variables based on variant differences
|
|
110
|
-
//
|
|
111
|
-
// Format:
|
|
112
|
-
// - For colors with light/dark variants: --color-{name}-{variant}: {color-value}
|
|
113
|
-
// - For colors without variants: --color-{name}: {color-value}
|
|
114
|
-
//
|
|
115
|
-
// Examples:
|
|
116
|
-
// --color-main-light: #ffffff
|
|
117
|
-
// --color-main-dark: #1a1d21
|
|
118
|
-
// --color-accent: #3498db (when light and dark variants are the same)
|
|
119
|
-
//
|
|
120
|
-
// Usage:
|
|
121
|
-
// .my-element {
|
|
122
|
-
// background-color: var(--color-main-light);
|
|
123
|
-
// color: var(--color-accent);
|
|
124
|
-
// }
|
|
125
|
-
:root {
|
|
126
|
-
@each $color, $modes in $colors {
|
|
127
|
-
// Validate parameters
|
|
128
|
-
$checkedLight: val.mapItem($modes, 'light', 'light/dark', 'root-colors()');
|
|
129
|
-
$checkedDark: val.mapItem($modes, 'dark', 'light/dark', 'root-colors()');
|
|
130
|
-
|
|
131
|
-
$light: map.get($modes, 'light');
|
|
132
|
-
$dark: map.get($modes, 'dark');
|
|
133
|
-
|
|
134
|
-
// Validate colors
|
|
135
|
-
$checkedLightValue: val.hexColor('#{$color}.light', $light, 'root-colors()');
|
|
136
|
-
$checkedDarkValue: val.hexColor('#{$color}.dark', $dark, 'root-colors()');
|
|
137
|
-
|
|
138
|
-
@if ($light == $dark) {
|
|
139
|
-
--color-#{$color}: #{$checkedLightValue};
|
|
140
|
-
} @else {
|
|
141
|
-
--color-#{$color}-light: #{$checkedLightValue};
|
|
142
|
-
--color-#{$color}-dark: #{$checkedDarkValue};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use '../variables' as vars;
|
|
3
|
+
@use '../settings/defaults' as defs;
|
|
4
|
+
@use '../functions/validations' as val;
|
|
5
|
+
@use '../settings/configs' as configs;
|
|
6
|
+
@use '../functions/colors' as colors;
|
|
7
|
+
@use '../settings/index' as settings;
|
|
8
|
+
|
|
9
|
+
// Definitions
|
|
10
|
+
$useColors: if(vars.$useColors != null, vars.$useColors, settings.$useColors);
|
|
11
|
+
$colors: if(vars.$colors != (), vars.$colors, defs.$colors);
|
|
12
|
+
$useCurrentColors: if(vars.$useCurrentColors != null, vars.$useCurrentColors, settings.$useCurrentColors);
|
|
13
|
+
$useRootColors: if(vars.$useRootColors != null, vars.$useRootColors, settings.$useRootColors);
|
|
14
|
+
|
|
15
|
+
// Colors System Module
|
|
16
|
+
// --------------------------
|
|
17
|
+
// This file is responsible for generating color utility classes and CSS variables
|
|
18
|
+
// based on the color maps defined in the variables file.
|
|
19
|
+
//
|
|
20
|
+
// Key features:
|
|
21
|
+
// 1. Generates color utility classes from the main colors map
|
|
22
|
+
// 2. Creates currentColor utility classes
|
|
23
|
+
// 3. Sets up CSS variables for all defined colors
|
|
24
|
+
//
|
|
25
|
+
// The color system supports:
|
|
26
|
+
// - Light and dark mode theming
|
|
27
|
+
// - Opacity variations
|
|
28
|
+
// - Pseudo-class variants (:hover, :focus, etc.)
|
|
29
|
+
//
|
|
30
|
+
// @requires ../functions/colors.scss - For color utility functions and mixins
|
|
31
|
+
// @requires ../settings/configs.scss - For configuration variables
|
|
32
|
+
// @requires ../functions/validations.scss - For validation utilities
|
|
33
|
+
// @requires ../variables.scss - For color definitions
|
|
34
|
+
|
|
35
|
+
@if $useColors {
|
|
36
|
+
// Color Utility Classes
|
|
37
|
+
// --------------------
|
|
38
|
+
// Generate color utility classes from the main colors map.
|
|
39
|
+
// Uses the useColorsMap mixin from colors functions to create a comprehensive
|
|
40
|
+
// set of color utilities for all the colors defined in $colors.
|
|
41
|
+
//
|
|
42
|
+
// Generated classes include:
|
|
43
|
+
// - .color-[colorName] - Sets text color
|
|
44
|
+
// - .bg-color-[colorName] - Sets background color
|
|
45
|
+
// - .border-color-[colorName] - Sets border color
|
|
46
|
+
//
|
|
47
|
+
// With light/dark theme variants:
|
|
48
|
+
// - Automatically applies correct color based on .light/.dark context
|
|
49
|
+
// - Supports direct class application with .color-[colorName].light
|
|
50
|
+
//
|
|
51
|
+
// With opacity variants (e.g., :50 for 50% opacity):
|
|
52
|
+
// - .color-[colorName]:50
|
|
53
|
+
// - .bg-color-[colorName]:75
|
|
54
|
+
//
|
|
55
|
+
// With pseudo-class variants:
|
|
56
|
+
// - .color-[colorName]:hover
|
|
57
|
+
// - .bg-color-[colorName]:focus
|
|
58
|
+
@include colors.useColorsMap;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@if $useCurrentColors {
|
|
62
|
+
// CurrentColor Utility Classes
|
|
63
|
+
// ----------------------------
|
|
64
|
+
// Creates utility classes for applying the CSS `currentColor` value to various CSS properties
|
|
65
|
+
// as defined in the configs.$colorsPropertiesMap.
|
|
66
|
+
//
|
|
67
|
+
// For each property in the map (color, background-color, border-color, etc.):
|
|
68
|
+
// - Creates a base class (.{property}-current-color)
|
|
69
|
+
// - Creates pseudo-class variants for interaction states
|
|
70
|
+
//
|
|
71
|
+
// Examples:
|
|
72
|
+
// - .current-color { color: currentColor; }
|
|
73
|
+
// - .bg-current-color { background-color: currentColor; }
|
|
74
|
+
// - .border-current-color { border-color: currentColor; }
|
|
75
|
+
// - .current-color\:hover:hover { color: currentColor; }
|
|
76
|
+
// - .bg-current-color\:focus:focus { background-color: currentColor; }
|
|
77
|
+
//
|
|
78
|
+
// Usage:
|
|
79
|
+
// <div class="current-color bg-current-color:hover">
|
|
80
|
+
// This text uses currentColor and background changes to currentColor on hover
|
|
81
|
+
// </div>
|
|
82
|
+
@each $class, $property in configs.$colorsPropertiesMap {
|
|
83
|
+
$mainClass: if($class, '#{$class}#{\:}current-color', 'current-color');
|
|
84
|
+
|
|
85
|
+
.#{$mainClass} {
|
|
86
|
+
#{$property}: currentColor;
|
|
87
|
+
|
|
88
|
+
@each $pseudoClass, $pseudo in configs.$colorsPseudoMap {
|
|
89
|
+
@if $pseudoClass != 'placeholder' or ($pseudoClass == 'placeholder' and $class == null) {
|
|
90
|
+
&#{\:}#{$pseudoClass}#{$pseudo} {
|
|
91
|
+
#{$property}: currentColor;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@if $useRootColors {
|
|
100
|
+
// CSS Color Variables
|
|
101
|
+
// ------------------
|
|
102
|
+
// Generates CSS custom properties (variables) for all colors in the $colors map.
|
|
103
|
+
// These variables can be used throughout the application to ensure color consistency.
|
|
104
|
+
//
|
|
105
|
+
// The implementation:
|
|
106
|
+
// 1. Iterates through each color in the $colors map
|
|
107
|
+
// 2. Validates the color values through val.mapItem and val.hexColor functions
|
|
108
|
+
// 3. Determines if light and dark variants are the same
|
|
109
|
+
// 4. Creates appropriate CSS variables based on variant differences
|
|
110
|
+
//
|
|
111
|
+
// Format:
|
|
112
|
+
// - For colors with light/dark variants: --color-{name}-{variant}: {color-value}
|
|
113
|
+
// - For colors without variants: --color-{name}: {color-value}
|
|
114
|
+
//
|
|
115
|
+
// Examples:
|
|
116
|
+
// --color-main-light: #ffffff
|
|
117
|
+
// --color-main-dark: #1a1d21
|
|
118
|
+
// --color-accent: #3498db (when light and dark variants are the same)
|
|
119
|
+
//
|
|
120
|
+
// Usage:
|
|
121
|
+
// .my-element {
|
|
122
|
+
// background-color: var(--color-main-light);
|
|
123
|
+
// color: var(--color-accent);
|
|
124
|
+
// }
|
|
125
|
+
:root {
|
|
126
|
+
@each $color, $modes in $colors {
|
|
127
|
+
// Validate parameters
|
|
128
|
+
$checkedLight: val.mapItem($modes, 'light', 'light/dark', 'root-colors()');
|
|
129
|
+
$checkedDark: val.mapItem($modes, 'dark', 'light/dark', 'root-colors()');
|
|
130
|
+
|
|
131
|
+
$light: map.get($modes, 'light');
|
|
132
|
+
$dark: map.get($modes, 'dark');
|
|
133
|
+
|
|
134
|
+
// Validate colors
|
|
135
|
+
$checkedLightValue: val.hexColor('#{$color}.light', $light, 'root-colors()');
|
|
136
|
+
$checkedDarkValue: val.hexColor('#{$color}.dark', $dark, 'root-colors()');
|
|
137
|
+
|
|
138
|
+
@if ($light == $dark) {
|
|
139
|
+
--color-#{$color}: #{$checkedLightValue};
|
|
140
|
+
} @else {
|
|
141
|
+
--color-#{$color}-light: #{$checkedLightValue};
|
|
142
|
+
--color-#{$color}-dark: #{$checkedDarkValue};
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|