feat(coding-agent): add automatic theme mode (#5874)

This commit is contained in:
Armin Ronacher
2026-06-18 17:13:47 +02:00
committed by GitHub
parent 908be616f2
commit d0b46764b1
16 changed files with 620 additions and 80 deletions

View File

@@ -1,6 +1,12 @@
import assert from "node:assert";
import { describe, it } from "node:test";
import { type Component, parseOsc11BackgroundColor, type Terminal, TUI } from "../src/index.ts";
import {
type Component,
parseOsc11BackgroundColor,
parseTerminalColorSchemeReport,
type Terminal,
TUI,
} from "../src/index.ts";
class TestTerminal implements Terminal {
private inputHandler?: (data: string) => void;
@@ -104,6 +110,16 @@ describe("parseOsc11BackgroundColor", () => {
});
});
describe("parseTerminalColorSchemeReport", () => {
it("parses color scheme reports", () => {
assert.strictEqual(parseTerminalColorSchemeReport("\x1b[?997;1n"), "dark");
assert.strictEqual(parseTerminalColorSchemeReport("\x1b[?997;2n"), "light");
assert.strictEqual(parseTerminalColorSchemeReport("\x1b[?997;3n"), undefined);
assert.strictEqual(parseTerminalColorSchemeReport("\x1b[?996n"), undefined);
assert.strictEqual(parseTerminalColorSchemeReport("x\x1b[?997;1n"), undefined);
});
});
describe("TUI.queryTerminalBackgroundColor", () => {
it("writes OSC 11 query and resolves with the parsed RGB reply", async () => {
const terminal = new TestTerminal();