fix: align theme truecolor detection

This commit is contained in:
Armin Ronacher
2026-05-18 21:56:48 +02:00
parent f10cf57e96
commit dafcf61a34
4 changed files with 61 additions and 35 deletions

View File

@@ -27,6 +27,7 @@ const ENV_KEYS = [
"GHOSTTY_RESOURCES_DIR",
"WEZTERM_PANE",
"ITERM_SESSION_ID",
"WT_SESSION",
"CMUX_WORKSPACE_ID",
] as const;
@@ -271,6 +272,31 @@ describe("detectCapabilities", () => {
assert.strictEqual(caps.hyperlinks, true);
});
});
it("detects truecolor for Windows Terminal outside multiplexers", () => {
withEnv({ WT_SESSION: "session", TERM: "xterm-256color" }, () => {
const caps = detectCapabilities();
assert.strictEqual(caps.trueColor, true);
});
});
it("does not inherit Windows Terminal truecolor through tmux", () => {
withEnv({ WT_SESSION: "session", TMUX: "/tmp/tmux-1000/default,1234,0", TERM: "tmux-256color" }, () => {
const caps = detectCapabilities();
assert.strictEqual(caps.trueColor, false);
assert.strictEqual(caps.hyperlinks, false);
assert.strictEqual(caps.images, null);
});
});
it("trusts explicit truecolor hints through tmux", () => {
withEnv({ COLORTERM: "truecolor", TMUX: "/tmp/tmux-1000/default,1234,0", TERM: "tmux-256color" }, () => {
const caps = detectCapabilities();
assert.strictEqual(caps.trueColor, true);
assert.strictEqual(caps.hyperlinks, false);
assert.strictEqual(caps.images, null);
});
});
});
describe("Kitty image cursor movement", () => {