lib/lolize/colorizer.rb
def rainbow
      red = Math.sin(@freq*@color + 0) * 127 + 128
      green = Math.sin(@freq*@color + 2*Math::PI/3) * 127 + 128
      blue  = Math.sin(@freq*@color + 4*Math::PI/3) * 127 + 128
      @color += 1/@spread
      "#%02X%02X%02X" % [ red, green, blue ]
    end
def rainbow
      red = Math.sin(@freq*@color + 0) * 127 + 128
      green = Math.sin(@freq*@color + 2*Math::PI/3) * 127 + 128
      blue  = Math.sin(@freq*@color + 4*Math::PI/3) * 127 + 128
      @color += 1/@spread
      "#%02X%02X%02X" % [ red, green, blue ]
    end
def rainbow red = Math . sin ( @freq @color + 0 ) * 127 + 128 green = Math . sin ( @freq @color + 2 * Math :: PI / 3 ) * 127 + 128 blue = Math . sin ( @freq @color + 4 * Math :: PI / 3 ) * 127 + 128 @color += 1 / @spread "#%02X%02X%02X" % [ red , green , blue ] end
The algorithm is from lolcat (https://github.com/busyloop/lolcat)
 lolcat is released with WTFPL
The algorithm is from lolcat ( https : // github . com / busyloop / lolcat ) lolcat is released with WTFPL