new (Color::Palette::Gimp)

        # File lib/color/palette/gimp.rb, line 43
    43:   def initialize(palette)
    44:     @colors   = []
    45:     @names    = {}
    46:     @valid    = false
    47:     @name     = "(unnamed)"
    48:
    49:     index     = 0
    50:
    51:     palette.split($/).each do |line|
    52:       line.chomp!
    53:       line.gsub!(/\s*#.*\Z/, '')
    54:
    55:       next if line.empty?
    56:
    57:       if line =~ /\AGIMP Palette\Z/
    58:         @valid = true
    59:         next
    60:       end
    61:
    62:       info = /(\w+):\s(.*$)/.match(line)
    63:       if info
    64:         @name = info.captures[1] if info.captures[0] =~ /name/i
    65:         next
    66:       end
    67:
    68:       line.gsub!(/^\s+/, '')
    69:       data = line.split(/\s+/, 4)
    70:       name = data.pop.strip
    71:       data.map! { |el| el.to_i }
    72:
    73:       color = Color::RGB.new(*data)
    74:
    75:       @colors[index]  = color
    76:       @names[name] ||= []
    77:       @names[name]  << color
    78:
    79:       index += 1
    80:     end
    81:   end