Skip to content

Instantly share code, notes, and snippets.

@cahnory
Created June 9, 2015 13:11
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 cahnory/5e75fcf81cf4f158a982 to your computer and use it in GitHub Desktop.
Save cahnory/5e75fcf81cf4f158a982 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
@mixin rgback($color, $alpha: 1, $rest...) {
@if 'color' != type-of($color) or 1 == alpha($color) {
$color: rgba($color, $alpha, $rest...);
}
@if alpha($color) < 1 {
background: url(
'#{$RGBACK__PATH}' +
'#{to-lower-case(str-slice(ie_hex_str($color), 4))}' +
'-#{alpha($color)}.png'
);
}
background: $color;
}
$RGBACK__PATH: '../img/rgba-'!default;
test {
@include rgback(#F80);
@include rgback(#F80, .5);
@include rgback(255, 136, 0, .5);
@include rgback(rgba(255, 136, 0, .5));
}
test {
background: #ff8800;
background: url("../img/rgba-ff8800-0.5.png");
background: rgba(255, 136, 0, 0.5);
background: url("../img/rgba-ff8800-0.5.png");
background: rgba(255, 136, 0, 0.5);
background: url("../img/rgba-ff8800-0.5.png");
background: rgba(255, 136, 0, 0.5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment