module Guard::UI
def color_enabled?
-
(Boolean)
- whether color is enabled or not
def color_enabled? @color_enabled_initialized ||= false @color_enabled = nil unless @color_enabled_initialized @color_enabled_initialized = true return @color_enabled unless @color_enabled.nil? return (@color_enabled = true) unless Gem.win_platform? return (@color_enabled = true) if ENV["ANSICON"] @color_enabled = begin require "rubygems" unless ENV["NO_RUBYGEMS"] require "Win32/Console/ANSI" true rescue LoadError info "Run 'gem install win32console' to use color on Windows" false end end