diff options
Diffstat (limited to 'src/_functions.scss')
-rw-r--r-- | src/_functions.scss | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/_functions.scss b/src/_functions.scss index 354c5f7..82e8435 100644 --- a/src/_functions.scss +++ b/src/_functions.scss | |||
@@ -1,3 +1,4 @@ | |||
1 | @use 'sass:color'; | ||
1 | @use 'sass:math'; | 2 | @use 'sass:math'; |
2 | @use 'sass:map'; | 3 | @use 'sass:map'; |
3 | @use 'iro-sass/src/index' as iro; | 4 | @use 'iro-sass/src/index' as iro; |
@@ -104,6 +105,10 @@ | |||
104 | @return $result; | 105 | @return $result; |
105 | } | 106 | } |
106 | 107 | ||
108 | @function gray-to-alpha($color) { | ||
109 | @return rgba(#fff, color.whiteness($color)); | ||
110 | } | ||
111 | |||
107 | @function color-palette($base, $dir: 1) { | 112 | @function color-palette($base, $dir: 1) { |
108 | @return ( | 113 | @return ( |
109 | --solid: ( | 114 | --solid: ( |
@@ -125,7 +130,7 @@ | |||
125 | ); | 130 | ); |
126 | } | 131 | } |
127 | 132 | ||
128 | @function gray-palette($lightness) { | 133 | @function gray-palette($lightness, $alpha: false) { |
129 | $grays: (); | 134 | $grays: (); |
130 | 135 | ||
131 | @for $i from 0 through 100 { | 136 | @for $i from 0 through 100 { |
@@ -135,7 +140,11 @@ | |||
135 | $colors: multi-contrast(blend.lch($lightness * 1% 0 0), $grays, config.$wanted-grays); | 140 | $colors: multi-contrast(blend.lch($lightness * 1% 0 0), $grays, config.$wanted-grays); |
136 | 141 | ||
137 | @each $key, $color in $colors { | 142 | @each $key, $color in $colors { |
138 | $colors: map.set($colors, $key, $color); | 143 | @if $alpha { |
144 | $colors: map.set($colors, $key, gray-to-alpha($color)); | ||
145 | } @else { | ||
146 | $colors: map.set($colors, $key, $color); | ||
147 | } | ||
139 | } | 148 | } |
140 | 149 | ||
141 | @return $colors; | 150 | @return $colors; |