Created
September 3, 2016 15:58
-
-
Save edwardsharp/ea8936524e1d4ce8cfa04ac754626258 to your computer and use it in GitHub Desktop.
high contract text color
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
| def text_color | |
| #simple lumen scale, (255 + 255 + 255 = 765) / 2 = 382.5 | |
| # color = '#ff6600' | |
| lumen = 0 | |
| lumen += color[1..2].hex | |
| lumen += color[3..4].hex | |
| lumen += color[5..6].hex | |
| if lumen > 382.5 | |
| return '#000000' | |
| else | |
| return '#ffffff' | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment