//go:build windows // +build windows package color import ( "os" "syscall" "unsafe" ) var ( kernel32 = syscall.NewLazyDLL("kernel32.dll") procGetConsoleMode = kernel32.NewProc("GetConsoleMode") ) // isTerminal checks if the file is a terminal on Windows func isTerminal(f *os.File) bool { handle := syscall.Handle(f.Fd()) var mode uint32 r1, _, _ := procGetConsoleMode.Call(uintptr(handle), uintptr(unsafe.Pointer(&mode))) return r1 != 0 } // isWindowsTerminal checks for Windows Terminal func isWindowsTerminal() bool { return os.Getenv("WT_SESSION") != "" }