36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/rbcli/components/logger/lolcat/lol.rb', line 36
def self.makestr(str, opts = {})
@os = rand(256) unless @paint_init
set_mode(opts[:truecolor]) unless @paint_init
result = ''
filtered = str.scan(ANSI_ESCAPE)
filtered.each_with_index do |c, i|
color = rainbow(opts[:freq], (@os + i) / opts[:spread])
if opts[:invert] then
result += c[0] + Paint.color(nil, color) + c[1] + "\e[49m"
else
result += c[0] + Paint.color(color) + c[1] + "\e[39m"
end
end
@os += opts[:slope]
result
end
|