Skip to content

Instantly share code, notes, and snippets.

@maddesigns
Created May 22, 2014 14:27
Show Gist options
  • Save maddesigns/6878c24db539e16872e8 to your computer and use it in GitHub Desktop.
Save maddesigns/6878c24db539e16872e8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.3.7)
// Compass (v1.0.0.alpha.18)
// ----
// @mixin x-rgba()
//
// RGBA IE fallback
// based on http://thesassway.com/intermediate/mixins-for-semi-transparent-colors
//
// usage:
// @include x-rgba(rgba(red, 0.6), white);
// @include x-rgba(rgba(red, 0.6), white, 'color');
@mixin x-rgba($color, $background, $attribute: "background-color") {
$percent: alpha($color) * 100%;
$opaque: opacify($color, 1);
$solid-color: mix($opaque, $background, $percent);
#{$attribute}: $solid-color;
#{$attribute}: $color;
}
.test {
@include x-rgba(rgba(red, 0.8), white);
@include x-rgba(rgba(red, 0.8), white, 'color');
}
.test {
background-color: #ff3232;
background-color: rgba(255, 0, 0, 0.8);
color: #ff3232;
color: rgba(255, 0, 0, 0.8);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment