Last active
January 8, 2017 09:45
-
-
Save vincenthz/5073c1ac4a4dbcee9716e152446fde9f to your computer and use it in GitHub Desktop.
Color Show with random deterministic color sequence
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
funkyShow :: Show a => a -> String | |
funkyShow l = "\x1b[" ++ c ++ dig ++ "\x1b[0m" | |
where | |
c = cols !! (fromEnum (head dig) `mod` lenCols) | |
dig = show l | |
lenCols = length cols | |
cols = ["31;1m", "32;1m", "33;1m", "34;1m", "35;1m", "36;1m"] {-"37;1m", "38;1m", "7m"] -} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment