Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't run OSC queries on CI #52

Merged
merged 1 commit into from Jan 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions termenv.go
Expand Up @@ -22,10 +22,18 @@ const (
TrueColor
)

func isTTY(fd uintptr) bool {
if len(os.Getenv("CI")) > 0 {
return false
}

return isatty.IsTerminal(fd)
}

// ColorProfile returns the supported color profile:
// Ascii, ANSI, ANSI256, or TrueColor.
func ColorProfile() Profile {
if !isatty.IsTerminal(os.Stdout.Fd()) {
if !isTTY(os.Stdout.Fd()) {
return Ascii
}

Expand All @@ -34,7 +42,7 @@ func ColorProfile() Profile {

// ForegroundColor returns the terminal's default foreground color.
func ForegroundColor() Color {
if !isatty.IsTerminal(os.Stdout.Fd()) {
if !isTTY(os.Stdout.Fd()) {
return NoColor{}
}

Expand All @@ -43,7 +51,7 @@ func ForegroundColor() Color {

// BackgroundColor returns the terminal's default background color.
func BackgroundColor() Color {
if !isatty.IsTerminal(os.Stdout.Fd()) {
if !isTTY(os.Stdout.Fd()) {
return NoColor{}
}

Expand Down