Created
April 17, 2015 06:26
-
-
Save evuez/895986822449ef300ab8 to your computer and use it in GitHub Desktop.
Lighten a color
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
def lighten(color, scale=1.0): | |
""" | |
Lighten a color. | |
- color must be a tuple (r, g, b, a) | |
- scale can be any number, if < 1, color will be darkened | |
""" | |
return map( | |
lambda x: int(min(max(x * scale, 0), 255)), | |
color[:3] | |
) + list(color[3:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment