Skip to content

Instantly share code, notes, and snippets.

@arlodesign
Last active August 29, 2015 14:25
Show Gist options
  • Save arlodesign/5614e68065dd3665a5ed to your computer and use it in GitHub Desktop.
Save arlodesign/5614e68065dd3665a5ed to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
@function color-diff($color-a, $color-b) {
$hue: hue($color-a) - hue($color-b);
$saturation: saturation($color-a) - saturation($color-b);
$lightness: lightness($color-a) - lightness($color-b);
$function-hue: 'adjust-hue';
$function-saturation: if($saturation > 0, 'desaturate', 'saturate');
$function-lightness: if($lightness > 0, 'darken', 'lighten');
@return (
#{$function-hue}: -($hue),
#{$function-saturation}: abs($saturation),
#{$function-lightness}: abs($lightness),
);
}
@function apply-color-diff($color, $diff) {
@each $key, $value in $diff {
$color: call($key, $color, $value);
}
@return $color;
}
@function hover-color($color) {
@return apply-color-diff($color, map-get($color-formulas, hover));
}
@function dark-color($color) {
@return apply-color-diff($color, map-get($color-formulas, dark));
}
@function light-color($color) {
@return apply-color-diff($color, map-get($color-formulas, light));
}
$green: #5acc5a;
$green-hover: #2cb757;
$green-dark: #0ca750;
$green-light: #75dd66;
$color-formulas: (
hover: color-diff($green, $green-hover),
dark: color-diff($green, $green-dark),
light: color-diff($green, $green-light)
);
$blue: #1d67a7;
$blue-hover: hover-color($blue);
$blue-dark: dark-color($blue);
$blue-light: light-color($blue);
/**
green: #{$green}
green-hover: #{$green-hover}
green-light: #{$green-light}
green-dark: #{$green-dark}
blue: #{$blue}
blue-hover: #{$blue-hover}
blue-light: #{$blue-light}
blue-dark: #{$blue-dark}
*/
/**
green: #5acc5a
green-hover: #2cb757
green-light: #75dd66
green-dark: #0ca750
blue: #1d67a7
blue-hover: #0e2573
blue-light: #158ecc
blue-dark: #000851
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment