Skip to content

Instantly share code, notes, and snippets.

@carwin
Created May 16, 2014 22:36
Show Gist options
  • Save carwin/5ec5eae6145fc49fdbc6 to your computer and use it in GitHub Desktop.
Save carwin/5ec5eae6145fc49fdbc6 to your computer and use it in GitHub Desktop.
element background magic
@mixin element-background($color, $direction: top) {
@if type-of($color) == list {
background-color: nth($color, 1);
@include background-image(linear-gradient($direction, $color));
}
else {
@if ($color != 'none') {
$percent: alpha($color) * 100%;
$opaque: opacify($color, 1);
$solid-color: mix($opaque, white, $percent);
background: $solid-color;
}
background: $color;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment