feat(palette): separate text coloring function to a new function
This commit is contained in:
parent
c0cfa3df07
commit
800dc309ba
1 changed files with 9 additions and 5 deletions
|
@ -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 {
|
||||
|
|
Reference in a new issue