Last active
August 29, 2015 14:04
-
-
Save Ke-/09394a6fcccb93a7b69d 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
| define char2int(p::string,mult::integer=1) => { | |
| match(#p) => { | |
| case('a') | |
| return 10 * #mult | |
| case('b') | |
| return 11 * #mult | |
| case('c') | |
| return 12 * #mult | |
| case('d') | |
| return 13 * #mult | |
| case('e') | |
| return 14 * #mult | |
| case('f') | |
| return 15 * #mult | |
| case | |
| return integer(#p) * #mult | |
| } | |
| } | |
| define hex2rgb(p::string) => { | |
| #p->removeleading('#') | |
| return (char2int(#p->get(1),16) + char2int(#p->get(2))) + ',' + | |
| (char2int(#p->get(3),16) + char2int(#p->get(4))) + ',' + | |
| (char2int(#p->get(5),16) + char2int(#p->get(6))) | |
| } | |
| hex2rgb('e64b32') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment