Skip to content

Instantly share code, notes, and snippets.

@jonnykates
Created April 22, 2018 16:27
Show Gist options
  • Save jonnykates/5e2212f066d6b3d04fa9006d808edc52 to your computer and use it in GitHub Desktop.
Save jonnykates/5e2212f066d6b3d04fa9006d808edc52 to your computer and use it in GitHub Desktop.
@function colour-difference($foreground, $background) {
$r: (max(red($foreground), red($background))) - (min(red($foreground), red($background)));
$g: (max(green($foreground), green($background))) - (min(green($foreground), green($background)));
$b: (max(blue($foreground), blue($background))) - (min(blue($foreground), blue($background)));
$sum-rgb: $r + $g + $b;
@if $sum-rgb < 500 {
@return "false";
} @else {
@return "true";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment