Created
May 12, 2017 20:31
-
-
Save LegitDongo/f3a24c1e8770eb497f2adc62278147ad to your computer and use it in GitHub Desktop.
Basic tint on RGB values in SASS using the power of math!
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
@function tint($r,$g,$b,$tint: .5) { | |
@return rgb( | |
$tint*$r + (1-$tint)*255, | |
$tint*$g + (1-$tint)*255, | |
$tint*$b + (1-$tint)*255 | |
); | |
} | |
//using | |
a{ | |
color: tint(0, 0, 255, 0.5); | |
} | |
//evaluates to | |
a{ | |
color: #0808ff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment