feat(palette): separate text coloring function to a new function

This commit is contained in:
Kazhnuz 2019-11-15 14:44:19 +01:00
parent c0cfa3df07
commit 800dc309ba

View file

@ -33,6 +33,14 @@ $whiteness_value: 0.8;
@return $luminance
}
@function getTextColorFromBackground($background-color, $light-color, $dark-color) {
@if (luminance($background-color ) < 255 * $whiteness_value) {
@return $light-color;
} @else {
@return $dark-color;
}
}
$color-primary: get-color("primary");
$color-secondary: get-color("secondary");
$color-warning: get-color("warning");
@ -50,11 +58,7 @@ $color-mark: get-color("yellow");
@mixin background-color($background-color, $light-color, $dark-color) {
background-color: $background-color!important;
@if (luminance($background-color ) < 255 * $whiteness_value) {
color: $light-color;
} @else {
color: $dark-color;
}
color: getTextColorFromBackground($background-color, $light-color, $dark-color);
}
.text {