mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
24 lines
483 B
Go
24 lines
483 B
Go
package terminal
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
// EnableVT100 启用颜色、控制字符
|
|
func EnableVT100() error {
|
|
stdout := windows.Handle(os.Stdout.Fd())
|
|
|
|
var mode uint32
|
|
err := windows.GetConsoleMode(stdout, &mode)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
mode |= windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING // 启用虚拟终端处理
|
|
mode |= windows.ENABLE_PROCESSED_OUTPUT // 启用处理后的输出
|
|
|
|
return windows.SetConsoleMode(stdout, mode)
|
|
}
|