@function color($value) @if type-of($value) == color @return true @else @return null @function color_list($values) @if list($values) @each $value in $values @if color($value) @return true @else @return null @else @return null @function optional_color_list($values) @if color($values) @return true @else if color_list($values) @return true @else @return null // tint & shade // http://bourbon.io/docs/#tint-shade @function tint($color, $percent) @return mix(white, $color, $percent) @function shade($color, $percent) @return mix(black, $color, $percent) // Adapted from: https://gist.github.com/voxpelli/6304812 @function luma($color) @if color($color) $rgba: red($color), green($color), blue($color) $rgba2: () @for $i from 1 through 3 $rgb: nth($rgba, $i) $rgb: $rgb / 255 $rgb: if($rgb < .03928, $rgb / 12.92, pow(($rgb + .055) / 1.055, 2.4)) $rgba2: append($rgba2, $rgb) @return (.2126 * nth($rgba2, 1) + .7152 * nth($rgba2, 2) + .0722 * nth($rgba2, 3))*100 @else @return $color @function luma_value($color-1, $color-2: null) @if $color-2 @return abs(luma($color-1) - luma($color-2)) @else @return luma($color-1) @function luma_which($color) @return if(luma($color) < 51, dark, bright) @function luma_bright($color) @if luma($color) < 51 @return null @else @return true @function luma_dark($color) @if luma($color) < 51 @return true @else @return null $luma-contrast-bright-color: $dark-text !default $luma-contrast-dark-color: $bright-text !default @function luma_contrast_color($color) @if luma_bright($color) @return if($luma-contrast-bright-color, $luma-contrast-bright-color, white) @else @return if($luma-contrast-dark-color, $luma-contrast-dark-color, black)