Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
add a show-all function
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Granger <ibdknox@gmail.com>
  • Loading branch information
ibdknox committed Nov 21, 2011
1 parent 794959a commit d89a13d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/colorize/core.clj
@@ -1,5 +1,6 @@
(ns colorize.core
"A set of functions to wrap strings in ansi-colors.")
"A set of functions to wrap strings in ansi-colors."
(:use [clojure.pprint :only [pprint]]))

(def ansi-colors {:reset "[0m"
:default "[39m"
Expand Down Expand Up @@ -42,6 +43,12 @@
[code & s]
(str (ansi code) (apply str s) (ansi :reset)))

(defn show-all []
(let [all-colors (apply juxt (for [cur (keys ansi-colors)]
(fn [input]
[cur (color cur input)])))]
(pprint (into (sorted-map) (all-colors "test")))))

(defmacro create-colors []
(apply list 'do
(for [k (keys ansi-colors)]
Expand Down

0 comments on commit d89a13d

Please sign in to comment.