Source File
detect_nonwin.go
Belonging Package
github.com/gookit/goutil/x/termenv
//go:build !windowspackage termenvimport ()// detect special term color support on macOS, linux, unixfunc detectSpecialTermColor( string) (ColorLevel, bool) {if == "" {// detect WSL as it has True Color support// on Windows WSL:// - runtime.GOOS == "Linux"// - support true-colorif checkfn.IsWSL() {debugf("True Color support on WSL environment")return TermColorTrue, false}return TermColorNone, false}debugf("terminfo check - fallback detect color by check TERM value")// on TERM=screen:// - support 256, not support true-color. test on macOSif == noTrueColorTerm {return TermColor256, false}if strings.Contains(, "256color") {return TermColor256, false}if strings.Contains(, "xterm") {return TermColor256, false}return TermColor16, false}func syscallStdinFd() int { return syscall.Stdin }func syscallStdoutFd() int { return syscall.Stdout }
![]() |
The pages are generated with Golds v0.8.4. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |