sass-planifolia

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

commit
899040a9573f597477344411242cca23915a0e1a
parent
9de2334ccd1965469d8de0b7255438d79d9ec039
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2017-12-04 22:46
avoid too little contrast contrast-stretch

Diffstat

M CHANGES.md 1 +
M sass/contrast.scss 14 ++++++--------

2 files changed, 7 insertions, 8 deletions


diff --git a/CHANGES.md b/CHANGES.md

@@ -1,6 +1,7 @@
    1     1 0.5.0 (unreleased)
    2     2 ------------------
    3     3 
   -1     4 - contrast: avoid cases with too little contrast in `contrast-stretch()`
    4     5 - color: add support for HSLab and HSLuv color spaces
    5     6 - color: change behavior of chroma/saturation in HSL color space
    6     7 

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

@@ -159,22 +159,20 @@ $planifolia-contrast-light-default: white !default;
  159   159     @return $upper;
  160   160   }
  161   161 
  162    -1   $result: mix($lower, $upper);
  163    -1 
  164   162   // NOTE: This is not a usual binary search. It is possible that the contrast
  165   163   // first decreases for a while when going from $lower to $upper.  However, we
  166   164   // checked that it starts below $contrast, so the algorithm still works.
  167   165   @for $i from 0 to 10 {
  168    -1     @if contrast($base, $result) < $contrast {
  169    -1       $lower: $result;
   -1   166     $tmp: mix($lower, $upper);
   -1   167 
   -1   168     @if contrast($base, $tmp) < $contrast {
   -1   169       $lower: $tmp;
  170   170     } @else {
  171    -1       $upper: $result;
   -1   171       $upper: $tmp;
  172   172     }
  173    -1 
  174    -1     $result: mix($lower, $upper);
  175   173   }
  176   174 
  177    -1   @return $result;
   -1   175   @return $upper;
  178   176 }
  179   177 
  180   178 /// Warn if the contrast is below a threshold.