Skip to content

Commit

Permalink
fix: #26 #25 color not rendered on windows 10
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Sep 12, 2020
1 parent c55546f commit f7ee41b
Show file tree
Hide file tree
Showing 7 changed files with 531 additions and 0 deletions.
File renamed without changes.
31 changes: 31 additions & 0 deletions _examples/color_tag.go
@@ -0,0 +1,31 @@
package main

import (
"fmt"
"strings"

"github.com/gookit/color"
)

// go run ./_examples/color_tag1.go
func main() {
i := 0
fmt.Println("Current env whether support color:", color.IsSupportColor())
fmt.Print("All color tags:\n\n")

for tag := range color.GetColorTags() {
if strings.Contains(tag, "_") {
continue
}

i++
color.Tag(tag).Print(tag+" tag")
if i%5 == 0 {
fmt.Print("\n")
} else {
fmt.Print(" ")
}
}

fmt.Printf("\n\ntotal tags: %d\n", i)
}
7 changes: 7 additions & 0 deletions _examples/envcheck.go
Expand Up @@ -2,11 +2,18 @@ package main

import (
"fmt"
"os"
"runtime"

"github.com/gookit/color"
"github.com/gookit/goutil/dump"
)

func main() {
fmt.Println("OS", runtime.GOOS)

fmt.Println("IsSupport256Color", color.IsSupport256Color())
fmt.Println("IsSupportColor", color.IsSupportColor())

dump.P(os.Environ())
}
7 changes: 7 additions & 0 deletions _examples/go.mod
@@ -0,0 +1,7 @@
module color.example

go 1.12

require github.com/gookit/color v1.2.9

replace github.com/gookit/color => ../
16 changes: 16 additions & 0 deletions _examples/go.sum
@@ -0,0 +1,16 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gookit/color v1.2.9 h1:1gwRqF/u6wZrxzn+thlROF7D4Toi9eVGUidZNAxAZHE=
github.com/gookit/color v1.2.9/go.mod h1:AhIE+pS6D4Ql0SQWbBeXPHw7gY0/sjHoA4s/n1KB7xg=
github.com/gookit/goutil v0.3.5 h1:95hWrCXcz7wuwlvcHw7YyUbFH0fV15YM0WPioYMcZww=
github.com/gookit/goutil v0.3.5/go.mod h1:OHs5W5Xmfj4pCMXHnMxsDPrCc0SRbHLgJ2qs6wr5fxM=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
18 changes: 18 additions & 0 deletions _examples/issue26.go
@@ -0,0 +1,18 @@
package main

import (
"fmt"
"time"

"github.com/gookit/color"
)

func main() {
green := color.HEX("#00FF62").Sprintf("Hello world!")
now := time.Now().Format("02-01-2006 15:04:05.000")

fmt.Printf("[%v] %v\n", now, green)

color.Printf("[%v] %v\n", now, green)
color.HEX("#00FF62").Println("Hello world!")
}

0 comments on commit f7ee41b

Please sign in to comment.