# File lib/highline/style.rb, line 157 def variant(new_name, options={}) raise "Cannot create a variant of a style list (#{inspect})" if @list new_code = options[:code] || code if options[:increment] raise "Unexpected code in #{inspect}" unless new_code =~ /^(.*?)(\d+)(.*)/ new_code = $1 + ($2.to_i + options[:increment]).to_s + $3 end new_rgb = options[:rgb] || @rgb new_style = self.class.new(self.to_hash.merge(:name=>new_name, :code=>new_code, :rgb=>new_rgb)) end