# File hexja, line 334 def parseColor(text) if text =~ /^#[0-9a-f]+$/i return text elsif text =~ /^[0-9]+(;[0-9]+)$/ return text else if $colors == nil $colors = { } IO.popen('showrgb', 'r').each_line{|line| line.chomp! if line =~ /^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\S.*)$/ r = $1 g = $2 b = $3 color = $4 $colors[color.downcase] = sprintf("#%02x%02x%02x", r, g, b) end } end if $colors[text.downcase] == nil print "unknown color: #{text}\n" exit 1 end return $colors[text.downcase] end end