diff options
author | thingsym <thingsym@gmail.com> | 2020-11-22 10:34:46 +0300 |
---|---|---|
committer | thingsym <thingsym@gmail.com> | 2020-11-22 10:34:46 +0300 |
commit | 7f7d6115716b083c5d6d72b122d6b679987520c3 (patch) | |
tree | 86c9f32bf49a23a18e1585fd58434d66d960b706 /src/scss/function/_contrast-color.scss | |
parent | 9ca28024bc70ca22e25d888b25e1a5f894c31c02 (diff) |
perf: replace scss from node-sass to dart-sass
Diffstat (limited to 'src/scss/function/_contrast-color.scss')
-rw-r--r-- | src/scss/function/_contrast-color.scss | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/scss/function/_contrast-color.scss b/src/scss/function/_contrast-color.scss index 75f341c..3867958 100644 --- a/src/scss/function/_contrast-color.scss +++ b/src/scss/function/_contrast-color.scss @@ -1,9 +1,13 @@ +@charset "utf-8"; + +// Built-In Modules +@use 'sass:math'; +@use 'sass:color'; + // =================================================================== // contrast color // =================================================================== -@charset "utf-8"; - @function contrast-color($color: null, $dark: #000, $light: #fff) { @if $color == null { @return null; @@ -13,10 +17,10 @@ $light-color-brightness: brightness($light); $dark-color-brightness: brightness($dark); - @return if(abs($color-brightness - $light-color-brightness) > abs($color-brightness - $dark-color-brightness), $light, $dark); + @return if(math.abs($color-brightness - $light-color-brightness) > math.abs($color-brightness - $dark-color-brightness), $light, $dark); } } @function brightness($color: null) { - @return ((red($color) * 299) + (green($color) * 587) + (blue($color) * 114)) / 1000; + @return ((color.red($color) * 299) + (color.green($color) * 587) + (color.blue($color) * 114)) / 1000; } |