Skip to content

Instantly share code, notes, and snippets.

@vincenthz
Last active January 8, 2017 09:45
Show Gist options
  • Save vincenthz/5073c1ac4a4dbcee9716e152446fde9f to your computer and use it in GitHub Desktop.
Save vincenthz/5073c1ac4a4dbcee9716e152446fde9f to your computer and use it in GitHub Desktop.
Color Show with random deterministic color sequence
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