def merge_similar_colors

        @colors.each do |info|
          per, c = *info
          info[1] = pure( dither( c ), s: nil, l:nil )
        end

        auto_link_colors!

        new_colors = {}
        @colors.each do |per, color|
          link_to = parent_color(color)
          if link_to
            new_colors[link_to] ||= 0
            new_colors[link_to] += per
          else
            new_colors[color.html] = per
          end
        end

        @colors = new_colors.map do |color_html, per|
          [per, Color::RGB.from_html(color_html)]
        end
      end
def merge_similar_colors

        @colors.each do |info|
          per, c = *info
          info[1] = pure( dither( c ), s: nil, l:nil )
        end

        auto_link_colors!

        new_colors = {}
        @colors.each do |per, color|
          link_to = parent_color(color)
          if link_to
            new_colors[link_to] ||= 0
            new_colors[link_to] += per
          else
            new_colors[color.html] = per
          end
        end

        @colors = new_colors.map do |color_html, per|
          [per, Color::RGB.from_html(color_html)]
        end
      end
TODO: 重构这个函数
 这里应该可以逻辑更加简单一些的