Last active
November 2, 2016 16:25
-
-
Save Camwyn/18676fe2fdfda64104e27226d021544e to your computer and use it in GitHub Desktop.
Opacity mixins with fallback color
This file contains hidden or 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
| /** | |
| * Translucent background colors with opaque text! | |
| * | |
| * @example scss | |
| * @include background-opacity(#000, .5) | |
| * | |
| * @param {String} $color hexadecimal color | |
| * @param {Integer} $opacity opacity value 0-1 | |
| */ | |
| @mixin background-opacity( $color, $opacity: .5 ) { | |
| background: $color; // fallback | |
| background: rgba( $color, $opacity ); | |
| } | |
| /** | |
| * Translucent border colors | |
| * | |
| * @example scss | |
| * @include background-opacity(#000, .5) | |
| * | |
| * @param {String} $color hexadecimal color | |
| * @param {Integer} $opacity opacity value 0-1 | |
| */ | |
| @mixin border-opacity( $color, $opacity: .5 ) { | |
| border-color: $color; // fallback | |
| border-color: rgba( $color, $opacity ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment