Evaluated proc ansi:closest {hex list} { set h ""; set d 16777215; for {set x 0} {$x < [llength $list]} {incr x} { set d2 [hexdist $hex [lindex $list $x]]; if {$d2 < $d} {set d $d2; set h $x }  }; return $h }