1
0
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:
Fatih Arslan 2015-03-12 13:27:56 +02:00
parent f19a133fbf
commit 253e0f98bf
2 changed files with 16 additions and 0 deletions

View File

@ -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
View 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")
)