Added terminal detection

This commit is contained in:
2024-03-12 00:25:20 +01:00
parent 393a9ebf17
commit 6a802c3ad8
12 changed files with 37 additions and 79 deletions

View File

@ -2,7 +2,9 @@ package color
import (
"os"
"git.akyoto.dev/go/color/tty"
)
// Terminal is a boolean that indicates if we're in a terminal with truecolor support.
var Terminal = os.Getenv("COLORTERM") == "truecolor"
var Terminal = tty.IsTerminal(os.Stdout.Fd()) && os.Getenv("COLORTERM") == "truecolor"