Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ide): crisp light-pane glyphs and readable faint text

rubenluetke10-beepf597de82ad5e
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
index edc3b858fa..171545f132 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
@@ -2669,6 +2669,21 @@ describe("terminal text size across a rebuild", () => {
);
});
+ it("draws a light pane opaque so its glyphs get subpixel smoothing", () => {
+ render(
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ appearance="light"
+ fontSize={13}
+ />,
+ );
+
+ expect(newest().options.allowTransparency).toBe(false);
+ expect((newest().options.theme as Record<string, unknown>).background).toBe("#fcfbf8");
+ expect(newest().options.fontWeight).toBe(600);
+ });
+
it("lets a TUI canvas fill fall through to the glass instead of covering it", () => {
render(
<AgenticTerminal
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index 4287618f69..d22bdffcf4 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -89,7 +89,7 @@ import {
type TerminalAppearance,
} from "./terminalThemes";
import { clearTuiCanvasFill } from "./terminalGlass";
-import { inkForLightPane } from "./terminalLightInk";
+import { createLightPaneInk } from "./terminalLightInk";
import {
extractPaneDrop,
extractPasteFiles,
@@ -956,10 +956,13 @@ export function AgenticTerminal({
const activateLink = createTerminalLinkActivator(linkOptions);
const term = new Terminal({
convertEol: false,
- // The pane shell supplies the shared section glass. xterm otherwise
- // paints an opaque canvas over it, hiding both that glass and the desktop
- // artwork even when the surrounding React container is translucent.
- allowTransparency: true,
+ // A dark pane keeps the canvas clear so the shared section glass and the
+ // desktop artwork show through. A light pane is opaque: xterm rasterises
+ // glyphs on a transparent canvas with greyscale anti-aliasing only, and
+ // dark ink on paper drawn that way reads thin and grey — on a 4K screen
+ // at 100 % scaling, barely legible (maintainer, 2026-10-01). On an
+ // opaque ground the glyph atlas gets the system's subpixel smoothing.
+ allowTransparency: appearanceRef.current !== "light",
// A CLI configured for the other ground paints truecolor a palette can
// never remap — dark-theme white text into a light pane. This floor
// nudges any unreadable foreground toward legibility; the theme's
@@ -1235,6 +1238,9 @@ export function AgenticTerminal({
*/
let resumeResize: (() => void) | null = null;
+ /** This pane's light-ground re-inker; it tracks the CLI's faint state. */
+ const lightInk = createLightPaneInk();
+
/** Hand bytes to xterm, keeping the count of what is still being parsed. */
const writeToTerminal = (text: string, afterWrite?: () => void) => {
parsing += 1;
@@ -1243,7 +1249,7 @@ export function AgenticTerminal({
// the way into xterm — see ./terminalGlass. A light pane also re-inks
// the dark-theme truecolor most CLIs paint — see ./terminalLightInk.
const glass = clearTuiCanvasFill(text);
- term.write(appearanceRef.current === "light" ? inkForLightPane(glass) : glass, () => {
+ term.write(appearanceRef.current === "light" ? lightInk(glass) : glass, () => {
parsing = Math.max(0, parsing - 1);
afterWrite?.();
// The parser is between chunks — the one safe moment to reflow.
@@ -2426,6 +2432,8 @@ export function AgenticTerminal({
const term = termRef.current;
if (!term) return;
term.options.theme = themeFor(appearance);
+ // Opaque on paper for subpixel-smoothed glyphs — see the constructor.
+ term.options.allowTransparency = appearance !== "light";
// A light pane draws one cut heavier (TERMINAL_FONT_WEIGHT_LIGHT). Every
// cut has the same advance, so the grid stays put and only glyphs change.
const weights = terminalFontWeights(appearance);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.ts
index 58b2e2d989..4c1536fd76 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalGlass.ts
@@ -26,6 +26,8 @@ function pack(r: number, g: number, b: number): number {
function packedFromCssRgb(css: string | undefined): number | null {
if (!css) return null;
+ const hex = css.match(/^#([0-9a-f]{6})$/i);
+ if (hex) return Number.parseInt(hex[1], 16);
const match = css.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/i);
if (!match) return null;
return pack(Number(match[1]), Number(match[2]), Number(match[3]));
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.test.ts
index 0cae4211a2..c836474e84 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.test.ts
@@ -1,6 +1,12 @@
import { describe, expect, it } from "vitest";
-import { inkForLightPane, lightGroundFor, lightInkFor, rewriteLightInkSgr } from "./terminalLightInk";
+import {
+ createLightPaneInk,
+ inkForLightPane,
+ lightGroundFor,
+ lightInkFor,
+ rewriteLightInkSgr,
+} from "./terminalLightInk";
function lum([r, g, b]: readonly number[]): number {
const ch = (v: number) => {
@@ -93,3 +99,45 @@ describe("inkForLightPane", () => {
expect(out).not.toContain("255;255;255");
});
});
+
+describe("faint text on a light pane", () => {
+ it("draws faint default-colour text in a readable grey instead of half opacity", () => {
+ const ink = createLightPaneInk();
+ expect(ink("\x1b[2mv0.159.3\x1b[22m done")).toBe(
+ "\x1b[38;2;110;110;114mv0.159.3\x1b[22;39m done",
+ );
+ });
+
+ it("takes the grey back on a full reset", () => {
+ const ink = createLightPaneInk();
+ expect(ink("\x1b[2mhint\x1b[0m")).toBe("\x1b[38;2;110;110;114mhint\x1b[0m");
+ });
+
+ it("keeps the state across chunks", () => {
+ const ink = createLightPaneInk();
+ expect(ink("\x1b[2mhi")).toBe("\x1b[38;2;110;110;114mhi");
+ expect(ink("nt\x1b[22m")).toBe("nt\x1b[22;39m");
+ });
+
+ it("leaves a CLI's own colour alone while faint is on", () => {
+ const ink = createLightPaneInk();
+ expect(ink("\x1b[2;31mred\x1b[22;39m")).toBe("\x1b[31mred\x1b[22;39m");
+ });
+
+ it("re-applies the grey when the CLI drops its colour but stays faint", () => {
+ const ink = createLightPaneInk();
+ ink("\x1b[2;31mred");
+ expect(ink("\x1b[39mgrey")).toBe("\x1b[39;38;2;110;110;114mgrey");
+ });
+
+ it("drops a repeated faint switch instead of emitting a reset", () => {
+ const ink = createLightPaneInk();
+ ink("\x1b[2ma");
+ expect(ink("\x1b[2mb")).toBe("b");
+ });
+
+ it("passes plain resets through", () => {
+ const ink = createLightPaneInk();
+ expect(ink("\x1b[mx\x1b[1my")).toBe("\x1b[mx\x1b[1my");
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.ts
index 436e965e22..05dc54892b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalLightInk.ts
@@ -183,24 +183,71 @@ function rewriteColon(token: string): string | null {
return rgb ? emit(kind, adapt(kind, rgb)) : null;
}
+/** One SGR parameter list re-inked, plus what it did to the pane's pen. */
+interface PenState {
+ /** SGR 2 (faint) is on. */
+ faint: boolean;
+ /** The CLI set its own foreground (ANSI, 256 or truecolor). */
+ fgExplicit: boolean;
+ /** We are drawing faint text in {@link FAINT_INK} on the CLI's behalf. */
+ injected: boolean;
+}
+
+/**
+ * The ink faint text gets on a light pane: #6e6e72, 4.9:1 on paper.
+ *
+ * xterm draws SGR 2 as the foreground at half opacity, and on an opaque light
+ * canvas that lands near #c8c8c8 — 1.6:1, the faint version numbers, paths
+ * and hints Codex and Claude Code print became all but invisible
+ * (maintainer, 2026-10-01). So a light pane never hands xterm the faint
+ * attribute; faint text on the default foreground is drawn in this grey
+ * instead, which keeps the hierarchy and stays readable.
+ */
+const FAINT_INK = "38;2;110;110;114";
+
+function isAnsiForeground(token: string): boolean {
+ const n = Number(token);
+ return token !== "" && ((n >= 30 && n <= 37) || (n >= 90 && n <= 97));
+}
+
/**
* Walk one SGR parameter list and re-ink every truecolor / 256-colour
- * foreground and background. Underline colour (`58`) is consumed so its
- * channel values are never read as setters, and otherwise left alone.
+ * foreground and background, updating `pen` as it goes. Underline colour
+ * (`58`) is consumed so its channel values are never read as setters, and
+ * otherwise left alone. Faint (`2`) is replaced by {@link FAINT_INK}.
*/
-export function rewriteLightInkSgr(params: string): string {
+export function rewriteLightInkSgr(params: string, pen: PenState = freshPen()): string {
const tokens = params.split(";");
const out: string[] = [];
for (let i = 0; i < tokens.length; i += 1) {
const token = tokens[i];
if (token.includes(":")) {
+ if (token.startsWith("38:")) pen.fgExplicit = true;
out.push(rewriteColon(token) ?? token);
continue;
}
+ if (token === "0" || token === "") {
+ pen.faint = false;
+ pen.fgExplicit = false;
+ pen.injected = false;
+ out.push(token);
+ continue;
+ }
+ if (token === "2") {
+ pen.faint = true;
+ continue;
+ }
+ if (token === "22") pen.faint = false;
+ if (token === "39") {
+ pen.fgExplicit = false;
+ pen.injected = false;
+ }
+ if (isAnsiForeground(token)) pen.fgExplicit = true;
if (token !== "38" && token !== "48" && token !== "58") {
out.push(token);
continue;
}
+ if (token === "38") pen.fgExplicit = true;
const mode = tokens[i + 1];
if (mode === "2" && i + 4 < tokens.length) {
const payload = tokens.slice(i + 1, i + 5);
@@ -217,22 +264,48 @@ export function rewriteLightInkSgr(params: string): string {
}
out.push(token);
}
+ if (pen.faint && !pen.fgExplicit) {
+ if (!pen.injected) {
+ out.push(FAINT_INK);
+ pen.injected = true;
+ }
+ } else if (pen.injected) {
+ // Faint ended, or the CLI chose its own colour: hand the pen back.
+ if (!pen.fgExplicit) out.push("39");
+ pen.injected = false;
+ }
return out.join(";");
}
+function freshPen(): PenState {
+ return { faint: false, fgExplicit: false, injected: false };
+}
+
const SGR = /\x1b\[([0-9;:]*)m/g;
/**
- * Re-ink complete SGR sequences in `text` for a light pane.
+ * A re-inker for one light pane: call it on every chunk headed for xterm.
*
- * A CSI split across two PTY reads is left for xterm, the same as
- * ./terminalGlass does; the contrast floor covers that rare chunk.
+ * Stateful because faint is: SGR 2 and the `22` that ends it usually arrive
+ * in different sequences, and the grey drawn in its place has to be taken
+ * back exactly when the CLI's faint would have ended. A CSI split across two
+ * PTY reads is left for xterm, the same as ./terminalGlass does.
*/
+export function createLightPaneInk(): (text: string) => string {
+ const pen = freshPen();
+ return (text: string) => {
+ if (!text.includes("\x1b[")) return text;
+ return text.replace(SGR, (full, params: string) => {
+ const next = rewriteLightInkSgr(params, pen);
+ if (next === params) return full;
+ // A list that only switched faint on, while our grey already stands,
+ // has nothing left to say — and `ESC[m` would mean reset.
+ return next === "" ? "" : `\x1b[${next}m`;
+ });
+ };
+}
+
+/** Stateless one-shot form, for a chunk with no history. */
export function inkForLightPane(text: string): string {
- if (!text.includes("\x1b[")) return text;
- return text.replace(SGR, (full, params: string) => {
- if (!params.includes("38") && !params.includes("48")) return full;
- const next = rewriteLightInkSgr(params);
- return next === params ? full : `\x1b[${next}m`;
- });
+ return createLightPaneInk()(text);
}
diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts
index 48ed99e190..8272638254 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalThemes.ts
@@ -28,9 +28,12 @@ import type { ITheme } from "@xterm/xterm";
* ground: darker, more saturated hues, with the "bright" row kept genuinely
* distinguishable rather than lighter.
*
- * The xterm canvas itself stays transparent. The stable reading ground comes
- * from the translucent pane shell below it, so the desktop artwork remains
- * visible without stacking two dark fills into an effectively opaque panel.
+ * On a dark pane the xterm canvas stays transparent. The stable reading
+ * ground comes from the translucent pane shell below it, so the desktop
+ * artwork remains visible without stacking two dark fills into an effectively
+ * opaque panel. A light pane is opaque instead: glyphs rasterised onto a
+ * transparent canvas lose subpixel smoothing, and dark ink on paper drawn
+ * that way reads thin and grey.
* A TUI that still paints its own `bg_base` on every cell (Grok Build's
* fullscreen themes do) is cleared on the way into xterm — see
* ./terminalGlass — so that fill becomes the same default background Claude
@@ -60,9 +63,10 @@ export const MINIMUM_CONTRAST_RATIO = 4.5;
/** Warm-paper contrast palette for light mode. */
export const LIGHT_TERMINAL_THEME: ITheme = {
- // Alpha 0 = still transparent; the RGB is the light shell's paper tone so
- // the minimum-contrast maths measures against the ground actually shown.
- background: "rgba(252, 251, 248, 0)",
+ // Opaque, unlike the dark theme: a light pane draws with
+ // `allowTransparency` off so its glyphs get subpixel smoothing (see
+ // ./AgenticTerminal), and the paper here is the ground the reader sees.
+ background: "#fcfbf8",
foreground: "#18181c",
cursor: "#0a0a0a",
cursorAccent: "#fcfbf8",
@@ -97,7 +101,8 @@ export const LIGHT_TERMINAL_THEME: ITheme = {
*/
export const DARK_TERMINAL_THEME: ITheme = {
// #12141a at alpha 0 — the deep-slate ground the backend also reports to the
- // CLI (jarvis/agentic_ide/terminal_input.py); see the light theme's note.
+ // CLI (jarvis/agentic_ide/terminal_input.py), and the ground the
+ // minimum-contrast maths measures against.
background: "rgba(18, 20, 26, 0)",
foreground: "#f4f4f6",
cursor: "#ffffff",
@@ -311,7 +316,9 @@ export const PANE_SOLID: Record<TerminalAppearance, string> = {
export const PANE_CHROME: Record<TerminalAppearance, PaneChrome> = {
light: {
- shell: "rgba(252, 251, 248, 0.86)",
+ // Opaque to match the light terminal canvas, which must be opaque for
+ // crisp glyphs; a translucent shell would leave a seam round the text.
+ shell: "rgb(252, 251, 248)",
border: "rgba(38,37,30,0.2)",
float: "#ffffff",
edge: {