-
sass – 2 colors gradient mixin with fallback
// calculate the middle color for fallback @mixin middle-color($c1, $c2) background-color: rgb((red($c1) + red($c2)) / 2, (green($c1) + green($c2)) / 2, (blue($c1) + blue($c2)) / 2) // generate linear-gradient @mixin linear-gradient($angle, $c1, $c2, $fallback: “”) // background color fallback @if ($fallback !== “”) background-color: $fallback @else @include middle-color($c1, $c2) // webkit linear gradient fallback @if…