Evaluated proc gen_palette str { set chars [uniq_chars $str]; set palette [list]; set forbid {\*+.\\/\$^()\}\{|\]\[?}; foreach letter [split [trim $chars] ""] {if {[string first $letter $forbid] > 0} {set letter [prepend "\\" $letter]}; lappend palette [list [. $letter] [gay]] }; . $palette }