diff options
Diffstat (limited to 'src/tui/light_unix.go')
-rw-r--r-- | src/tui/light_unix.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tui/light_unix.go b/src/tui/light_unix.go index e4ce6313..18788702 100644 --- a/src/tui/light_unix.go +++ b/src/tui/light_unix.go @@ -5,6 +5,8 @@ package tui import ( "fmt" "os" + "os/exec" + "strings" "syscall" "github.com/junegunn/fzf/src/util" @@ -15,6 +17,17 @@ func IsLightRendererSupported() bool { return true } +func (r *LightRenderer) defaultTheme() *ColorTheme { + if strings.Contains(os.Getenv("TERM"), "256") { + return Dark256 + } + colors, err := exec.Command("tput", "colors").Output() + if err == nil && atoi(strings.TrimSpace(string(colors)), 16) > 16 { + return Dark256 + } + return Default16 +} + func (r *LightRenderer) fd() int { return int(r.ttyin.Fd()) } |