module AsciiPaint::Config::Default

Default values for configuration settings.

Constants

CHARACTER_HEIGHT
CHARACTER_WIDTH
COLOR_FOR_UNDEFINED_CHARACTER
COLOR_MAP

Private Class Methods

rainbow_mapping(characters) click to toggle source
# File lib/ascii_paint/config.rb, line 112
def self.rainbow_mapping(characters)
  # Thanks jbum (http://krazydad.com/tutorials/makecolors.php)
  hash = {}
  period = Math::PI * 2
  frequency = period / characters.count
  characters.each_with_index do |char, index|
    r = Math.cos(frequency * index + 0) * 127 + 128;
    g = Math.cos(frequency * index + period / 3) * 127 + 128;
    b = Math.cos(frequency * index + period * 2 / 3) * 127 + 128;
    color = ChunkyPNG::Color.rgb(r.to_i, g.to_i, b.to_i)
    hash[char] = color
  end
  hash
end