25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/wirb/colorizer/wirb0_highline.rb', line 25
def self.color_name(*colors)
colors = colors.flatten.compact
if colors.first == :highline colors[1..-1]
else
translated_colors = colors.map do |color|
color = color.to_s
case color
when "nothing"
color = "clear"
when /light_gray/
color = color.sub("light_gray", "white")
when /dark_gray/
color = color.sub("dark_gray", "light_black") when /yellow/
color = color.sub("yellow", "light_yellow") when /white/
color = color.sub("white", "light_white") when /brown/
color = color.sub("brown", "yellow")
when /purple/
color = color.sub("purple", "magenta")
end
color_set = [color.to_sym]
if color_set.first.to_s =~ /^light_(.*)/
color_set[0] = $1.to_sym
color_set << :bold
end
case color_set.first.to_s
when /(.*)_underline$/
color_set[0] = [$1.to_sym]
color_set << :underline
when /(.*)_background$/
color_set[0] = [('on_'+$1).to_sym]
end
color_set
end
translated_colors.flatten
end
end
|