Sha256: 4b26145c0f9a5dcd1eeedcc54554f24bcdc2d61bc7776bf4c02297275b659941

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

/*
   Compass YIQ Color Contrast
   https://github.com/easy-designs/yiq-color-contrast
   ========================================================================== */

@function yiq-is-light($color, $threshold: $yiq-contrasted-threshold) {
  $red: red($color);
  $green: green($color);
  $blue: blue($color);

  $yiq: (($red * 299)+ ($green * 587)+ ($blue * 114))/1000;

  @if $yiq-debug {
    @debug $yiq, $threshold;
  }

  @return if($yiq >= $threshold, true, false);
}

@function yiq-contrast-color(
  $color,
  $dark: $yiq-contrasted-dark-default,
  $light: $yiq-contrasted-light-default,
  $threshold: $yiq-contrasted-threshold
) {
  @return if(yiq-is-light($color, $threshold), $yiq-contrasted-dark-default, $yiq-contrasted-light-default);
}

@mixin yiq-contrasted(
  $background-color,
  $dark: $yiq-contrasted-dark-default,
  $light: $yiq-contrasted-light-default,
  $threshold: $yiq-contrasted-threshold
) {
  background-color: $background-color;
  color: yiq-contrast-color($background-color, $dark, $light, $threshold);
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jekyll-theme-twail-1.0.0 _sass/vendors/_mixins.scss