def gen_palettes( count: 1, accent_seed: nil, max_pri_brightness: 1 )
        count               = 1 if accent_seed
        @max_pri_brightness = max_pri_brightness
        @main_color         = most_possible_main_color
        @accent_colors      = []

        palettes = count.times.map do |i|
          gen_palette( accent_seed: accent_seed, fewest_index: i )
        end.compact.sort_by do |pal|
          pal[:primary].to_hsl.h
        end

        if palettes.size < count

          if palettes.empty?
            return preset_palettes( count: count )
          end

          last_primary_color = palettes.last[:primary].to_hsl
          main_color         = palettes.last[:back].to_hsl
          puts last_primary_color.html
          (count - palettes.size ).times do |i|
            if i.even?
              color = last_primary_color.dup.tap do |c|
                h   = c.h
                h  += ((i+1)/2.0).ceil / 10.0
                h  += 1 if h < 0 
                c.h = h
                c.l = 0.33
              end.to_rgb
            else
              color = main_color.dup.tap do |c|
                h   = c.h
                h  -= ((i+1)/2.0).ceil / 10.0
                h  += 1 if h < 0 
                c.h = h
                c.l = 0.33
              end.to_rgb
            end
            next if already_have_similar_accent_color?( color )
            palettes << gen_palette( accent_seed: color )
          end
        end

        palettes.compact
      end
def gen_palettes( count: 1, accent_seed: nil, max_pri_brightness: 1 )
        count               = 1 if accent_seed
        @max_pri_brightness = max_pri_brightness
        @main_color         = most_possible_main_color
        @accent_colors      = []

        palettes = count.times.map do |i|
          gen_palette( accent_seed: accent_seed, fewest_index: i )
        end.compact.sort_by do |pal|
          pal[:primary].to_hsl.h
        end

        if palettes.size < count

          if palettes.empty?
            return preset_palettes( count: count )
          end

          last_primary_color = palettes.last[:primary].to_hsl
          main_color         = palettes.last[:back].to_hsl
          puts last_primary_color.html
          (count - palettes.size ).times do |i|
            if i.even?
              color = last_primary_color.dup.tap do |c|
                h   = c.h
                h  += ((i+1)/2.0).ceil / 10.0
                h  += 1 if h < 0 
                c.h = h
                c.l = 0.33
              end.to_rgb
            else
              color = main_color.dup.tap do |c|
                h   = c.h
                h  -= ((i+1)/2.0).ceil / 10.0
                h  += 1 if h < 0 
                c.h = h
                c.l = 0.33
              end.to_rgb
            end
            next if already_have_similar_accent_color?( color )
            palettes << gen_palette( accent_seed: color )
          end
        end

        palettes.compact
      end
目前采用最简单