module Cucumber::Formatter::ANSIColor

def self.define_grey #:nodoc:

:nodoc:
def self.define_grey #:nodoc:
  gem 'genki-ruby-terminfo'
  require 'terminfo'
  case TermInfo.default_object.tigetnum('colors')
  when 0
    raise "Your terminal doesn't support colours."
  when 1
    ::Cucumber::Term::ANSIColor.coloring = false
    alias_method :grey, :white
  when 2..8
    alias_method :grey, :white # rubocop:disable Lint/DuplicateMethods
  else
    define_real_grey
  end
rescue Exception => e # rubocop:disable Lint/RescueException
  if e.class.name == 'TermInfo::TermInfoError'
    STDERR.puts '*** WARNING ***'
    STDERR.puts "You have the genki-ruby-terminfo gem installed, but you haven't set your TERM variable."
    STDERR.puts 'Try setting it to TERM=xterm-256color to get grey colour in output.'
    STDERR.puts "\n"
    alias_method :grey, :white
  else
    define_real_grey
  end
end

def self.define_real_grey #:nodoc:

:nodoc:
def self.define_real_grey #:nodoc:
  define_method :grey do |string|
    ::Cucumber::Term::ANSIColor.coloring? ? "\e[90m#{string}\e[0m" : string
  end
end

def cukes(n)

def cukes(n)
  ('(::) ' * n).strip
end

def green_cukes(n)

def green_cukes(n)
  blink(green(cukes(n)))
end

def red_cukes(n)

def red_cukes(n)
  blink(red(cukes(n)))
end

def yellow_cukes(n)

def yellow_cukes(n)
  blink(yellow(cukes(n)))
end