Created
October 22, 2012 17:37
-
-
Save freshyill/3932845 to your computer and use it in GitHub Desktop.
Link color mixin... this might be either really useful or really stupid.
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
// These are global colors | |
$lcolor: #7ab4e5; | |
$vcolor: #7ab4e5; | |
$hcolor: #e62c25; | |
$acolor: lighten($hcolor, 10%); | |
$fcolor: $hcolor; | |
$link-transition: .15s color ease-in-out | |
// Mixin will let you override globals... or not, depending on what you pass to it. | |
@mixin links($link:"", $visited:"", $hover:"", $active:"", $focus:"", $transition:"") { | |
&:link { | |
@if $link != "" { color: #{$link}; } | |
@else { color: $lcolor; } | |
} | |
&:visited { | |
@if $visited != "" { color: #{$visited}; } | |
@else { color: $vcolor; } | |
} | |
&:hover { | |
@if $hover != "" { color: #{$hover}; } | |
@else { color: $hcolor; } | |
} | |
&:active { | |
@if $active != "" { color: #{$active}; } | |
@else { color: #e62c25; } | |
} | |
&:focus { | |
@if $focus != "" { color: #{$focus}; } | |
@else { color: $fcolor; } | |
} | |
@if $transition != "" { @include transition(#{$transition}); } | |
@else { @include transition($link-transition); } | |
} | |
// Usage - all arguments are optional | |
a { @include links($link: red, $visited: blue);} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment