module TTY::Color
Responsible for checking terminal color support
@api public
Constants
- NoValue
- VERSION
Attributes
Public Instance Methods
Source
# File lib/tty/color.rb, line 67 def command?(cmd) !!system(cmd, out: ::File::NULL, err: ::File::NULL) end
Check if command can be run
@return [Boolean]
@api public
Source
# File lib/tty/color.rb, line 40 def disabled? Support.new(ENV, verbose: verbose).disabled? end
Detect if color support has been disabled with NO_COLOR ENV var.
@return [Boolean]
true when terminal color support has been disabled, false otherwise
@api public
Source
# File lib/tty/color.rb, line 49 def mode Mode.new(ENV).mode end
Check how many colors this terminal supports
@return [Integer]
@api public
Source
# File lib/tty/color.rb, line 27 def support? Support.new(ENV, verbose: verbose).support? end
Check if terminal supports colors
@return [Boolean]
@api public
Source
# File lib/tty/color.rb, line 58 def tty? output.respond_to?(:tty?) && output.tty? end
Check if output is linked with terminal
@return [Boolean]
@api public
Source
# File lib/tty/color.rb, line 76 def windows? ::File::ALT_SEPARATOR == "\\" end
Check if Windowz
@return [Boolean]
@api public