Merge pull request #404 from abperiasamy/win-color

disable console theme on Windows
This commit is contained in:
Anand Babu (AB) Periasamy
2015-04-17 16:32:12 -07:00
2 changed files with 11 additions and 2 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ var (
flags = []cli.Flag{
cli.StringFlag{
Name: "theme",
Value: "minimal",
Value: console.GetDefaultTheme(),
Usage: fmt.Sprintf("Choose a console theme from this list [%s]", func() string {
keys := []string{}
for key := range console.ThemesDB {
+10 -1
View File
@@ -20,6 +20,7 @@ import (
"errors"
"fmt"
"os"
"runtime"
"sync"
"github.com/fatih/color"
@@ -30,7 +31,7 @@ var (
mutex = &sync.RWMutex{}
// currentTheme is currently set theme
currentTheme = "minimal"
currentTheme = GetDefaultTheme()
// ThemesDB contains supported list of Themes
ThemesDB = map[string]Theme{"minimal": MiniTheme, "nocolor": NoColorTheme, "white": WhiteTheme}
// Fatal prints a fatal message and exits
@@ -153,3 +154,11 @@ func SetTheme(themeName string) error {
func GetTheme() string {
return currentTheme
}
// GetDefaultTheme returns the default theme
func GetDefaultTheme() string {
if runtime.GOOS == "windows" {
return "nocolor"
}
return "minimal"
}