File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,18 @@ const (
22
22
TrueColor
23
23
)
24
24
25
+ func isTTY (fd uintptr ) bool {
26
+ if len (os .Getenv ("CI" )) > 0 {
27
+ return false
28
+ }
29
+
30
+ return isatty .IsTerminal (fd )
31
+ }
32
+
25
33
// ColorProfile returns the supported color profile:
26
34
// Ascii, ANSI, ANSI256, or TrueColor.
27
35
func ColorProfile () Profile {
28
- if ! isatty . IsTerminal (os .Stdout .Fd ()) {
36
+ if ! isTTY (os .Stdout .Fd ()) {
29
37
return Ascii
30
38
}
31
39
@@ -34,7 +42,7 @@ func ColorProfile() Profile {
34
42
35
43
// ForegroundColor returns the terminal's default foreground color.
36
44
func ForegroundColor () Color {
37
- if ! isatty . IsTerminal (os .Stdout .Fd ()) {
45
+ if ! isTTY (os .Stdout .Fd ()) {
38
46
return NoColor {}
39
47
}
40
48
@@ -43,7 +51,7 @@ func ForegroundColor() Color {
43
51
44
52
// BackgroundColor returns the terminal's default background color.
45
53
func BackgroundColor () Color {
46
- if ! isatty . IsTerminal (os .Stdout .Fd ()) {
54
+ if ! isTTY (os .Stdout .Fd ()) {
47
55
return NoColor {}
48
56
}
49
57
You can’t perform that action at this time.
0 commit comments