Sha256: 08f3f4b8be2c6f06194a32e0aed7637b40b2fe07f1549ff2d412cd3697fbc788
Contents?: true
Size: 545 Bytes
Versions: 5
Compression:
Stored size: 545 Bytes
Contents
module Pork module Rainbows def msg_pass @rainbows ||= -1 @rainbows += +1 color256(rainbows(@rainbows), strip_color(super)) end private def strip_color text text.gsub(/\e\[\d+m/, '') end def color256 rgb, text "\e[38;5;#{rgb}m#{text}\e[0m" end def rainbows i n = (i%42) / 6.0 r = Math.sin(n + 0*Math::PI/3) * 3 + 3 g = Math.sin(n + 2*Math::PI/3) * 3 + 3 b = Math.sin(n + 4*Math::PI/3) * 3 + 3 16 + 36*r.to_i + 6*g.to_i + b.to_i end end end
Version data entries
5 entries across 5 versions & 1 rubygems