blob: c2801d7f0f2e80550e66d7ed1448f46330da831a [file] [log] [blame]
/* light, strong, medium */
@function get_contrast ($strength, $color, $desaturate: true) {
$new-color: $color;
$new-color: darken($color, $strength);
$strength-offset: 50; //in case of unexpected bright spots in dark themes
@if lightness($new-color) <= 5 {
@if $strength > $strength-offset {
$new-color: darken($color, $strength - $strength-offset);
//@warn "doppeldunkel #{$new-color}-";
}
@else {
$new-color: lighten($color, $strength);
}
}
@else if lightness($new-color) >= 95 {
$new-color: darken($color, $strength);
}
@if $desaturate == true {
$new-color: desaturate($new-color, 100%);
}
@return $new-color;
}
@function get_color_mix ($color, $mix, $strength) {
$new-color: mix($color, $mix, $strength);
@return $new-color;
}
/*
* Luminance Formula
* Y = 0.2126 R + 0.7152 G + 0.0722 B
83 96 122
@function is-dark-color($color) {
$luminance: color-luminance($color);
@if $luminance < $v-luminance-threshold or (saturation($color) > 80% and ($luminance < $v-luminance-threshold + 20)) {
@return true;
} @else {
@return false;
}
} */