Created
July 29, 2015 17:38
-
-
Save brandonferens/ab2294e580e65644e596 to your computer and use it in GitHub Desktop.
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
// Sass's lighten function just adds the supplied percentage to the existing color's percentage | |
// making it really difficult to adjust a color's lightness in any sort of logical way. This | |
// function solves that issue increasing the percentage relative to the color's lightness. | |
@function lightenColor($color, $percentage) { | |
$diff: 100 - lightness($color); // Find the percentage difference | |
$quotient: $diff / 100%; // Dividing a percentage by a percentage return a decimal | |
$newPercentage: $quotient * $percentage; | |
@return lighten($color, $newPercentage); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment