Resistor color code by bk1e

#!ruby -n
r=$_.to_f
r*=1e3if/k/
r*=1e6if/M/
l="%.2e"%r
d=[l[0]-?0,l[2]-?0]
d<<l[3]-?0 if l[3]!=?0
d<<l.split(/e/)[1].to_i+1-d.size
puts d.map{|d|%w[Silver Gold Black Brown Red Orange Yellow Green Blue Violet Grey White][d+2]}.join('-')

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page