v0.2.0 16 colors, default colors, /dev/tty, bracketed paste, themed form controls

This commit is contained in:
lixen committed 2026-10-09 14:15:46 -04:00
1 parent 070131c7fd
commit 2b5d127e84
32 files changed
+1447 -424

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
package env
import "testing"
// A text console, VT100-class included, gets 16 colors whatever COLORTERM
// says; vte, a modern emulator, is not one
func TestTextConsoleWinsOverColorterm(t *testing.T) {
for _, v := range trueColorVars {
t.Setenv(v, "")
}
t.Setenv("COLORTERM", "truecolor")
for term, want := range map[string]int{
"linux": 16, "cons25": 16, "vt220": 16, "ansi": 16, "xterm-16color": 16,
"vte-256color": 1 << 24, "vt": 1 << 24, "xterm-256color": 1 << 24,
} {
t.Setenv("TERM", term)
if got := Colors(); got != want {
t.Errorf("TERM=%s: %d colors, want %d", term, got, want)
}
}
t.Setenv("COLORTERM", "")
t.Setenv("TERM", "vte-256color")
if got := Colors(); got != 256 {
t.Errorf("vte-256color: %d", got)
}
}