Skip to content

Instantly share code, notes, and snippets.

@omgmog
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save omgmog/373a48f47e4df7ce35f0 to your computer and use it in GitHub Desktop.
Save omgmog/373a48f47e4df7ce35f0 to your computer and use it in GitHub Desktop.
Display h/s/l difference between colors in a list of colors
@mixin determine_color_difference($first, $second) {
$hue: hue($first) - hue($second);
$sat: saturation($first) - saturation($second);
$lightness: lightness($first) - lightness($second);
@debug '------------------';
@debug 'First: #{$first}';
@debug 'Second: #{$second}';
@debug 'Hue difference: #{$hue}';
@debug 'Saturation difference: #{$sat}';
@debug 'Lightness difference: #{$lightness}';
}
@mixin loop_over_color_list($color_list) {
@each $color in $color_list {
$next: if(
(index($color_list, $color)+1)>length($color_list),
1,
(index($color_list, $color)+1)
);
@include determine_color_difference(
$color,
nth($color_list, $next)
);
}
}
$reds: (
#FFEBEE,
#FFCDD2,
#EF9A9A,
#E57373,
#EF5350,
#F44336,
#E53935,
#D32F2F,
#C62828,
#B71C1C,
);
@include loop_over_color_list($reds);
$blues: (
#E3F2FD,
#BBDEFB,
#90CAF9,
#64B5F6,
#42A5F5,
#2196F3,
#1E88E5,
#1976D2,
#1565C0,
#0D47A1,
);
@include loop_over_color_list($blues);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment