-
Notifications
You must be signed in to change notification settings - Fork 552
Commit
Respect the declaration of the of the NO_COLOR environment variable as a sign that color output should be suppressed in he tool. This informal standard is described at https://no-color.org
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,7 +97,11 @@ def set_color(string, *colors) | |
protected | ||
|
||
def can_display_colors? | ||
stdout.tty? | ||
stdout.tty? && !are_colors_disabled? | ||
end | ||
|
||
def are_colors_disabled? | ||
!ENV['NO_COLOR'].nil? | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
matthewd
Member
|
||
end | ||
|
||
# Overwrite show_diff to show diff with colors if Diff::LCS is | ||
|
This returns
true
even ifNO_COLOR
is set to an empty string.https://no-color.org proposes: