Skip to content
Snippets Groups Projects
Commit 9df563f2 authored by Markus Reiter's avatar Markus Reiter
Browse files

Add `Tty::color?`.

parent 7f39d333
No related branches found
No related tags found
No related merge requests found
......@@ -64,10 +64,17 @@ module Tty
end
def to_s
return "" if !ENV["HOMEBREW_COLOR"] && (ENV["HOMEBREW_NO_COLOR"] || !$stdout.tty?)
return "" unless color?
current_escape_sequence
ensure
reset_escape_sequence!
end
def color?
return false if ENV["HOMEBREW_NO_COLOR"]
return true if ENV["HOMEBREW_COLOR"]
$stdout.tty?
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment