Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gui/src/pages/Usage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ function UsageFilters({
<img className="usage-source-mark" src="/provider-icons/claude-color.svg" alt="" aria-hidden="true" />
)}
{choice === "grok" && (
<img className="usage-source-mark" src="/provider-icons/grok.svg" alt="" aria-hidden="true" />
<img className="usage-source-mark usage-source-mark--mono" src="/provider-icons/grok.svg" alt="" aria-hidden="true" />
)}
<span className={choice === "all" ? "usage-source-label" : "usage-source-label usage-source-label-collapsible"}>
{label}
Expand Down
6 changes: 4 additions & 2 deletions gui/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2083,10 +2083,12 @@ button.prov-account-row.active { cursor: default; }
.usage-segmented-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: none; background: transparent; color: var(--muted); padding: 4px 12px; border-radius: var(--radius-pill); cursor: pointer; font: inherit; white-space: nowrap; }
.usage-segmented-btn.active { background: var(--raised); color: var(--text); font-weight: var(--weight-semibold); }
.usage-source-mark { width: var(--icon-sm); height: var(--icon-sm); flex: 0 0 auto; object-fit: contain; }
:root[data-theme="dark"] .usage-source-mark { filter: invert(1); }
/* Only monochrome source marks (Grok) are inverted for dark themes. Brand-colored
marks (Claude, Codex/OpenAI) must keep their brand color; inverting shifts the hue. */
:root[data-theme="dark"] .usage-source-mark--mono { filter: invert(1); }

@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) .usage-source-mark { filter: invert(1); }
:root:not([data-theme="light"]) .usage-source-mark--mono { filter: invert(1); }
}

@media (max-width: 760px) {
Expand Down
21 changes: 21 additions & 0 deletions gui/tests/usage-layout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,3 +142,24 @@ test("Usage renders Available history and a persistent qualification when histor
}
}
});

test("Usage source marks keep brand colors and invert only the monochrome Grok mark", async () => {
const page = await Bun.file(new URL("../src/pages/Usage.tsx", import.meta.url)).text();
const css = await Bun.file(new URL("../src/styles.css", import.meta.url)).text();

// Claude and Codex ship brand-colored SVGs and must not carry the mono modifier.
expect(page).toContain('src="/provider-icons/claude-color.svg"');
expect(page).not.toContain('usage-source-mark usage-source-mark--mono" src="/provider-icons/claude-color.svg"');
expect(page).toContain('src="/provider-icons/openai.svg"');
expect(page).not.toContain('usage-source-mark usage-source-mark--mono" src="/provider-icons/openai.svg"');

// Grok ships a black monochrome mark: it is the only one that needs dark-theme inversion.
expect(page).toContain('usage-source-mark usage-source-mark--mono" src="/provider-icons/grok.svg"');

// Dark-theme inversion must be scoped to the mono modifier so brand hues survive.
expect(css).toContain(':root[data-theme="dark"] .usage-source-mark--mono { filter: invert(1); }');
expect(css).not.toContain(':root[data-theme="dark"] .usage-source-mark { filter: invert(1); }');
Comment thread
coderabbitai[bot] marked this conversation as resolved.
// The OS dark-mode (prefers-color-scheme) path must keep the same scoping.
expect(css).toContain(':root:not([data-theme="light"]) .usage-source-mark--mono { filter: invert(1); }');
expect(css).not.toContain(':root:not([data-theme="light"]) .usage-source-mark { filter: invert(1); }');
});
Loading