| ... | @@ -20,6 +20,8 @@ pub fn detectConfig(file: File) Config { | ... | @@ -20,6 +20,8 @@ pub fn detectConfig(file: File) Config { |
| 20 | | 20 | |
| 21 | if (force_color == false) return .no_color; | 21 | if (force_color == false) return .no_color; |
| 22 | | 22 | |
| | 23 | if (file.supportsAnsiEscapeCodes()) return .escape_codes; |
| | 24 | |
| 23 | if (native_os == .windows and file.isTty()) { | 25 | if (native_os == .windows and file.isTty()) { |
| 24 | var info: windows.CONSOLE_SCREEN_BUFFER_INFO = undefined; | 26 | var info: windows.CONSOLE_SCREEN_BUFFER_INFO = undefined; |
| 25 | if (windows.kernel32.GetConsoleScreenBufferInfo(file.handle, &info) != windows.TRUE) { | 27 | if (windows.kernel32.GetConsoleScreenBufferInfo(file.handle, &info) != windows.TRUE) { |
| ... | @@ -31,11 +33,7 @@ pub fn detectConfig(file: File) Config { | ... | @@ -31,11 +33,7 @@ pub fn detectConfig(file: File) Config { |
| 31 | } }; | 33 | } }; |
| 32 | } | 34 | } |
| 33 | | 35 | |
| 34 | if (force_color == true or file.supportsAnsiEscapeCodes()) { | 36 | return if (force_color == true) .escape_codes else .no_color; |
| 35 | return .escape_codes; | | |
| 36 | } | | |
| 37 | | | |
| 38 | return .no_color; | | |
| 39 | } | 37 | } |
| 40 | | 38 | |
| 41 | pub const Color = enum { | 39 | pub const Color = enum { |