Sass YIQ 2.0.0

Functions & Mixins

@function is-light()

Determines whether a given color is light or dark. The YIQ color space function gives weights each RGB value according to how sensitive they are to human eyesight.

Since v2.0:

– Renamed from yiq-is-light

Parameters & Return

$color: (Color)

The color to test

$threshold: $contrasted-threshold (Number)

The YIQ lightness value that $color should be tested against. Acceptable values are between 0 & 255.

@return (Boolean)

true if color is light

Requires

$debug (Boolean)

Used By

@function contrast-color()

@function contrast-color()

Returns an appropriate color to ensure proper contrast

Since v2.0:

– Renamed from yiq-contrast-color

Parameters & Return

$base: (Color)

The color to be tested

$dark: (Color)

The color to return if $base is light

$light: (Color)

The color to return if $base is dark

$threshold: $contrasted-threshold (Number)

The YIQ lightness value that $base should be tested against. Acceptable values are between 0 & 255.

@return (Color)

$dark if $base is light, $light is $base if dark

Requires

@function is-light()

Used By

@mixin contrasted()

@mixin contrasted()

Sets the specified background color and calculates a dark or light contrasted text color

Since v2.0:

– Renamed from yiq-contrasted

Parameters & Output

$base: (Color)

The color to be tested

$dark: (Color)

The color to return if $base is light

$light: (Color)

The color to return if $base is dark

$threshold: $contrasted-threshold (Number)

The YIQ lightness value that $base should be tested against. Acceptable values are between 0 & 255.

{CSS output} (code block)

a background-color/text color combination with proper contrasting

Requires

@function contrast-color()