sass-planifolia

Vanilla Sass helper functions
git clone https://git.ce9e.org/sass-planifolia.git

commit
4629e970035d322c598ee46721b6d5980811b555
parent
458e8adcb147d6733bae2b611bb87cf8e8158c0b
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2017-07-21 15:22
contrast: improve pow approximation

account for badly conditioned contrast formular

Diffstat

M sass/contrast.scss 11 +++++++++--

1 files changed, 9 insertions, 2 deletions


diff --git a/sass/contrast.scss b/sass/contrast.scss

@@ -16,8 +16,15 @@ $planifolia-contrast-light-default: white !default;
   16    16     @return $x / 12.92;
   17    17   } @else {
   18    18     $c: ($x + .055) / 1.055;
   19    -1     // approximation for pow($c, 2.4)
   20    -1     @return (133 * $c * $c * $c + 155 * $c * $c) / 288;
   -1    19     @if function-exists('pow') {
   -1    20       @return pow($c, 2.4);
   -1    21     } @else {
   -1    22       // approximation for pow($c, 2.4)
   -1    23       //
   -1    24       // NOTE that `contrast()` amplifies the errors generated here.
   -1    25       // The factors a chosen to minify that effect.
   -1    26       @return 0.56 * ($c * $c * $c) + 0.44 * ($c * $c);
   -1    27     }
   21    28   }
   22    29 }
   23    30