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