Module: Aspera::Colors
- Defined in:
- lib/aspera/rainbow.rb
Overview
Detection of ANSI colors support, replaces the one of Rainbow https://no-color.org https://bixense.com/clicolors/
Class Method Summary collapse
-
.detect ⇒ Boolean
True if ANSI colors shall be used, from environment and terminal.
Class Method Details
.detect ⇒ Boolean
Returns true if ANSI colors shall be used, from environment and terminal.
19 20 21 22 23 24 |
# File 'lib/aspera/rainbow.rb', line 19 def detect return false if env_set?('NO_COLOR') return true if env_set?('CLICOLOR_FORCE') && !ENV['CLICOLOR_FORCE'].eql?('0') return false if ENV['CLICOLOR'].eql?('0') $stdout.tty? && $stderr.tty? && !ENV['TERM'].eql?('dumb') end |