Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: keep the segmented control track visible in the dark Settings pane (#11653)

Michael Hanffa4ff6f9370
diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.css
index 87c735e0179..6244f3f1645 100644
--- a/studio/frontend/src/features/hub/hub.css
+++ b/studio/frontend/src/features/hub/hub.css
@@ -716,9 +716,14 @@
}
/* 6.5%, in line with .hub-chip. At 4.5% the track sat 9 levels off the page
- and the unselected half of the control had nothing to stand on. */
+ and the unselected half of the control had nothing to stand on. Set as a
+ variable so the nearest surface picks the track (see below). */
+ html.dark {
+ --hub-tab-track: color-mix(in srgb, var(--foreground) calc(6.5% * var(--contrast-wash-gain, 1)), transparent);
+ }
+
html.dark .hub-tab-toggle {
- background-color: color-mix(in srgb, var(--foreground) calc(6.5% * var(--contrast-wash-gain, 1)), transparent);
+ background-color: var(--hub-tab-track);
border: 0;
box-shadow: none;
}
@@ -730,10 +735,17 @@
instead of lifting it off the panel, stopping under it at #232323. No
wash gain here: that guard keeps lit washes from fading out, and this one
darkens. */
- html.dark .menu-soft-surface .hub-tab-toggle,
- html.dark .menu-soft-surface-up .hub-tab-toggle,
- html.dark [data-slot="dialog-content"] .hub-tab-toggle {
- background-color: color-mix(in srgb, var(--background) 27%, transparent);
+ html.dark :is(.menu-soft-surface, .menu-soft-surface-up, [data-slot="dialog-content"]),
+ html.dark :is(.menu-soft-surface, .menu-soft-surface-up, [data-slot="dialog-content"]) .bg-background[class*="dark:bg-"] {
+ --hub-tab-track: color-mix(in srgb, var(--background) 27%, transparent);
+ }
+
+ /* A page-coloured pane inside a panel (the Settings content pane) is the
+ page again. Sunk there, the track matched the pane and vanished. A card
+ that repaints its bg-background in dark is raised again, so it stays
+ sunk (above). */
+ html.dark :is(.menu-soft-surface, .menu-soft-surface-up, [data-slot="dialog-content"]) .bg-background:not([class*="dark:bg-"]) {
+ --hub-tab-track: color-mix(in srgb, var(--foreground) calc(6.5% * var(--contrast-wash-gain, 1)), transparent);
}
html:not(.dark) .hub-tab-toggle-pill {
diff --git a/studio/frontend/tests/hub-tab-toggle-track.test.ts b/studio/frontend/tests/hub-tab-toggle-track.test.ts
index 86f95e0773f..bffb182a659 100644
--- a/studio/frontend/tests/hub-tab-toggle-track.test.ts
+++ b/studio/frontend/tests/hub-tab-toggle-track.test.ts
@@ -10,42 +10,78 @@ import { readSrc } from "./helpers/kit.ts";
// from the selected pill is a property of the surface, not of the control. On
// the page the wash lands 21 levels below --accent; on an elevated panel the
// same wash lands 7 below and the two halves stop reading apart. These pin the
-// panel case darkening instead, and the pill's hover on borrowed-pill buttons.
+// panel case darkening instead, a page-coloured pane inside a panel getting the
+// page track back, a raised card in that pane sinking again, and the pill's
+// hover on borrowed-pill buttons.
const HUB_CSS = readSrc("features/hub/hub.css");
const PICKERS = readSrc(
"features/model-picker/components/model-selector/pickers.tsx",
);
-const MENU_TRACK =
- /html\.dark \.menu-soft-surface \.hub-tab-toggle,[\s\S]*?\{([^}]*)\}/;
+const PANELS =
+ ':is(.menu-soft-surface, .menu-soft-surface-up, [data-slot="dialog-content"])';
+const esc = (text: string) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+const PAGE_TRACK = /html\.dark \{([^}]*--hub-tab-track[^}]*)\}/;
+const RAISED = '.bg-background[class*="dark:bg-"]';
+const PANEL_TRACK = new RegExp(
+ `html\\.dark ${esc(PANELS)},\\s*html\\.dark ${esc(PANELS)} ${esc(RAISED)} \\{([^}]*)\\}`,
+);
+const PANE_TRACK = new RegExp(
+ `html\\.dark ${esc(PANELS)} ${esc('.bg-background:not([class*="dark:bg-"])')} \\{([^}]*)\\}`,
+);
+
+test("the track reads its colour from the nearest surface", () => {
+ const rule = HUB_CSS.match(/html\.dark \.hub-tab-toggle \{([^}]*)\}/);
+ assert.ok(rule);
+ assert.match(rule[1] ?? "", /background-color: var\(--hub-tab-track\)/);
+});
test("a track on an elevated panel sinks toward the page, not off the panel", () => {
- const rule = HUB_CSS.match(MENU_TRACK);
- assert.ok(rule, "menu-scoped .hub-tab-toggle rule is missing");
+ const rule = HUB_CSS.match(PANEL_TRACK);
+ assert.ok(rule, "panel-scoped track is missing");
// Mixing --foreground here is what put the track 7 levels off the pill.
- assert.match(rule[1] ?? "", /var\(--background\)/);
+ assert.match(rule[1] ?? "", /--hub-tab-track: [^;]*var\(--background\)/);
assert.doesNotMatch(rule[1] ?? "", /var\(--foreground\)/);
});
-test("the panel track overrides the page one rather than racing it", () => {
- const base = HUB_CSS.indexOf("html.dark .hub-tab-toggle {");
- const scoped = HUB_CSS.search(MENU_TRACK);
- assert.ok(base >= 0 && scoped >= 0);
- // Higher specificity already wins; source order keeps it obvious.
- assert.ok(scoped > base, "the scoped rule must follow the page one");
-});
-
test("the page track is left on its own wash", () => {
- const base = HUB_CSS.match(/html\.dark \.hub-tab-toggle \{([^}]*)\}/);
+ const base = HUB_CSS.match(PAGE_TRACK);
assert.ok(base);
- assert.match(base[1] ?? "", /var\(--foreground\)/);
+ assert.match(base[1] ?? "", /var\(--foreground\) calc\(6\.5%/);
});
test("the panel track stops just under the panel rather than far below it", () => {
- const rule = HUB_CSS.match(MENU_TRACK);
// 27% of #181818 over #272727 is #232323.
- assert.match(rule?.[1] ?? "", /var\(--background\) 27%/);
+ assert.match(
+ HUB_CSS.match(PANEL_TRACK)?.[1] ?? "",
+ /var\(--background\) 27%/,
+ );
+});
+
+test("a page-coloured pane inside a panel gets the page track back", () => {
+ // The Settings content pane is bg-background inside the dialog. Sunk toward
+ // the page there, the track matched the pane and the control lost its track.
+ const pane = HUB_CSS.match(PANE_TRACK);
+ assert.ok(pane, "page-coloured panes inside panels still sink the track");
+ const page = HUB_CSS.match(PAGE_TRACK);
+ assert.equal(
+ pane[1]?.trim(),
+ page?.[1]?.trim(),
+ "pane and page tracks differ",
+ );
+ // Later in the file, so it beats the panel rule on a tie.
+ assert.ok(HUB_CSS.search(PANE_TRACK) > HUB_CSS.search(PANEL_TRACK));
+ const settings = readSrc("features/settings/settings-dialog.tsx");
+ assert.match(settings, /<main className="[^"]*\bbg-background\b/);
+});
+
+test("a raised card inside a page-coloured pane keeps the panel track", () => {
+ // Profile's StatsCard is bg-background washed 6% white in dark. On the page
+ // track its pill sat 1.14:1 above the track, against 1.42:1 sunk.
+ assert.ok(HUB_CSS.match(PANEL_TRACK), "raised cards lost the sunk track");
+ const card = readSrc("features/profile/components/stats/stat-primitives.tsx");
+ assert.match(card, /\bbg-background dark:border-transparent dark:bg-\[/);
});
test("a selected segment shows no hover, being the tab you are already on", () => {