Skip to content

Commit c32e973

Browse files
optimized helper
1 parent 30e2310 commit c32e973

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

src/Utilities/helpers.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
/// Text Colors
3030
///
3131
@include setHelperList($text-colors, "color", "!important");
32-
@include setColorScale($text-colors, false);
32+
@include setColorScale($text-colors, "color");
3333

3434
///
3535
/// Background Colors

src/Utilities/mixins.scss

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -116,30 +116,16 @@
116116
/// @param {Array} $colors
117117
/// @param {Boolean} $bgcolor
118118
///
119-
@mixin setColorScale($colors, $bgcolor : true) {
119+
@mixin setColorScale($colors, $property:'background-color') {
120120
@for $i from 5 through 35 {
121121
@each $class, $color in $colors {
122122
@if $i % 5 == 0 {
123123
$percentage: $i*1%;
124-
125-
@if $bgcolor {
126-
// darken
127-
.#{$class}-darken-#{$i} {
128-
background-color: darken($color, $percentage);
129-
}
130-
// lighten
131-
.#{$class}-lighten-#{$i} {
132-
background-color: lighten($color, $percentage);
133-
}
134-
} @else {
135-
// darken
136-
.#{$class}-darken-#{$i} {
137-
color: darken($color, $percentage);
138-
}
139-
// lighten
140-
.#{$class}-lighten-#{$i} {
141-
color: lighten($color, $percentage);
142-
}
124+
.#{$class}-darken-#{$i} {
125+
#{$property}: mix(black, $color, $percentage);
126+
}
127+
.#{$class}-lighten-#{$i} {
128+
#{$property}: mix(white, $color, $percentage);
143129
}
144130
}
145131
}

0 commit comments

Comments
 (0)