File tree 3 files changed +21
-3
lines changed
3 files changed +21
-3
lines changed Original file line number Diff line number Diff line change
1
+ package color
2
+
3
+ import (
4
+ "os"
5
+
6
+ "golang.org/x/sys/windows"
7
+ )
8
+
9
+ func init () {
10
+ // Opt-in for ansi color support for current process.
11
+ // https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#output-sequences
12
+ var outMode uint32
13
+ out := windows .Handle (os .Stdout .Fd ())
14
+ if err := windows .GetConsoleMode (out , & outMode ); err == nil {
15
+ outMode |= windows .ENABLE_PROCESSED_OUTPUT | windows .ENABLE_VIRTUAL_TERMINAL_PROCESSING
16
+ _ = windows .SetConsoleMode (out , outMode )
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -7,4 +7,4 @@ require (
7
7
github.com/mattn/go-isatty v0.0.17
8
8
)
9
9
10
- require golang.org/x/sys v0.3.0 // indirect
10
+ require golang.org/x/sys v0.5.0
Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/
4
4
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng =
5
5
github.com/mattn/go-isatty v0.0.17 /go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM =
6
6
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
7
- golang.org/x/sys v0.3 .0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ =
8
- golang.org/x/sys v0.3 .0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
7
+ golang.org/x/sys v0.5 .0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU =
8
+ golang.org/x/sys v0.5 .0 /go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg =
You can’t perform that action at this time.
0 commit comments