def make_palette(source)
      case source
      when :default
        make_const_palette(:category20)
      when Symbol
        make_const_palette(source)
      when Array
        ->(_, index){source[index % source.size]}
      when Proc
        source
      when ->(s){s.respond_to?(:color)}
        ->(word, index){source.color(word, index)}
      else
        fail ArgumentError, "Unknown palette: #{source.inspect}"
      end
    end
def make_palette(source)
      case source
      when :default
        make_const_palette(:category20)
      when Symbol
        make_const_palette(source)
      when Array
        ->(_, index){source[index % source.size]}
      when Proc
        source
      when ->(s){s.respond_to?(:color)}
        ->(word, index){source.color(word, index)}
      else
        fail ArgumentError, "Unknown palette: #{source.inspect}"
      end
    end
rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity,Metrics/AbcSize