Last active
August 29, 2015 14:10
-
-
Save fieldoffice/786b18866d95cee98151 to your computer and use it in GitHub Desktop.
Sass Control Directives - if statement
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
//MIXIN | |
@mixin text-inset($colour, $opacity: 0.5) { | |
@if lightness($colour) < 50% { | |
//DARK TEXT - LIGHT SHADOW | |
text-shadow: 1px 1px 1px rgba(#fff, $opacity); | |
} @else { | |
//LIGHT TEXT - DARK SHADOW | |
text-shadow: -1px -1px 1px rgba(#000, $opacity); | |
} | |
// set the text colour | |
color: $colour; | |
} | |
//CSS | |
%example { | |
font-weight: bold; | |
text-transform: uppercase; | |
} | |
.example { | |
@extend %example; | |
@include text-inset(#fff, 0.3); | |
} | |
//MARKUP | |
<span class="example">Hello</span> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment