Created
May 22, 2014 14:27
-
-
Save maddesigns/6878c24db539e16872e8 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// 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'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.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