mirror of
https://github.com/fatih/color.git
synced 2025-02-22 18:42:07 +02:00
color: start to play to implement Windows support
This commit is contained in:
parent
f19a133fbf
commit
253e0f98bf
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@ -11,6 +12,10 @@ import (
|
||||
// escaped formatted results. Next we create some visual tests to be tested.
|
||||
// Each visual test includes the color name to be compared.
|
||||
func TestColor(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("Windows is not supported")
|
||||
}
|
||||
|
||||
rb := new(bytes.Buffer)
|
||||
Output = rb
|
||||
|
||||
|
11
color_windows.go
Normal file
11
color_windows.go
Normal file
@ -0,0 +1,11 @@
|
||||
// +build windows
|
||||
|
||||
package color
|
||||
|
||||
import "syscall"
|
||||
|
||||
var (
|
||||
kernel32 = syscall.NewLazyDLL("kernel32.dll")
|
||||
procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
|
||||
procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user