Created
November 2, 2016 15:59
-
-
Save Camwyn/ab7340b5bfdb2583851ae594a48a21cb to your computer and use it in GitHub Desktop.
Theming colors mixin
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
| /** | |
| * Primary colors per locations | |
| * | |
| * $property: the CSS property you're setting | |
| * $value: the value of the property. Optional. | |
| * $selector: add a selector to help targeting. Optional. | |
| * $opacity: use a transparent/translucent color. Optional. | |
| * Example: @include location-color( 'border-top', 3px, '> a:hover:after', .8 ); | |
| */ | |
| $locations: ( | |
| location-1: $location-color-1, | |
| location-2: $location-color-2, | |
| location-3: $location-color-3, | |
| location-4: $location-color-4, | |
| ); | |
| @mixin location-color( $property, $value: "", $selector: false, $opacity: 1 ) { | |
| @each $location, $color in $locations { | |
| $curr-color: $color; | |
| @if 1 > $opacity { | |
| $curr-color: rgba( $color, $opacity ); | |
| } | |
| @if false == $selector { | |
| body.-#{$location} & { | |
| #{$property}: #{$value} #{$curr-color}; | |
| @content; | |
| } | |
| } @else { | |
| &.-#{$location} { | |
| #{$selector} { | |
| #{$property}: #{$value} #{$curr-color}; | |
| @content; | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment