# module Foreman::Engine::CLI::Color

### Constants

ANSI

### Public Class Methods

enable(io, force=false) click to toggle source

    # File lib/foreman/engine/cli.rb, line 27
    def self.enable(io, force=false)
      io.extend(self)
      @@color_force = force
    end

### Public Instance Methods

color(name) click to toggle source

    # File lib/foreman/engine/cli.rb, line 39
    def color(name)
      return "" unless color?
      return "" unless ansi = ANSI[name.to_sym]
      "\e[#{ansi}m"
    end

color?() click to toggle source

    # File lib/foreman/engine/cli.rb, line 32
    def color?
      return true if @@color_force
      return false if Foreman.windows?
      return false unless self.respond_to?(:isatty)
      self.isatty && ENV["TERM"]
    end