mirror of
https://github.com/junegunn/fzf.git
synced 2025-09-01 12:53:50 -07:00
Add truecolor support for Windows, if available (#2156)
- Update to latest tcell which has 24 bit Windows support - light renderer under Windows defaults to Dark256, if possible - Respect TCELL_TRUECOLOR - Remove tcell 1.3 references
This commit is contained in:
@@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user