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: Element outline setting, outlined light glass, Transparent glass with strength as opacity, glass Show on, and glass on pages without a background (#16890)

Michael Handc916c90a51f
diff --git a/studio/backend/routes/settings.py b/studio/backend/routes/settings.py
index 271cebc2085..184a5504bfd 100644
--- a/studio/backend/routes/settings.py
+++ b/studio/backend/routes/settings.py
@@ -4931,6 +4931,7 @@ class PersonalizationCustomization(BaseModel):
sentAttachments: Literal["auto", "list", "chips"] = "auto"
contrast: int = Field(50, ge = 0, le = 100)
composerOutline: Optional[int] = Field(None, ge = 0, le = 100)
+ elementOutline: Optional[int] = Field(None, ge = 0, le = 100)
pointerCursors: bool = False
reduceMotion: Literal["system", "on", "off"] = "off"
fontSmoothing: bool = True
diff --git a/studio/backend/tests/test_personalization_settings.py b/studio/backend/tests/test_personalization_settings.py
index 063d86fe956..c6e94aa4841 100644
--- a/studio/backend/tests/test_personalization_settings.py
+++ b/studio/backend/tests/test_personalization_settings.py
@@ -88,6 +88,7 @@ def test_customization_defaults():
c = p.appearance.customization
assert c.contrast == 50
assert c.composerOutline is None
+ assert c.elementOutline is None
assert c.reduceMotion == "off"
assert c.fontSmoothing is True
assert c.pointerCursors is False
@@ -507,6 +508,7 @@ def test_personalization_route_roundtrip_real_shape(monkeypatch):
"codeFontSize": 13,
"contrast": 60,
"composerOutline": 40,
+ "elementOutline": 0,
"pointerCursors": True,
"reduceMotion": "off",
"fontSmoothing": True,
diff --git a/studio/frontend/src/app/routes/__root.tsx b/studio/frontend/src/app/routes/__root.tsx
index 95e15ccae9b..56ad0d78b58 100644
--- a/studio/frontend/src/app/routes/__root.tsx
+++ b/studio/frontend/src/app/routes/__root.tsx
@@ -692,7 +692,7 @@ function RootLayout() {
<PersonalizationSyncMount />
<SttDeviceSyncMount />
<InterfaceZoom />
- <WindowMaterialMount />
+ <WindowMaterialMount route={hideNavbar ? undefined : isChatRoute ? "chat" : "page"} />
<ReloadSnapshotPrivacy />
{!isAuthFlowRoute && <ChatSettingsHydrationMount />}
{!isAuthFlowRoute && <LowDiskNoticeMount />}
diff --git a/studio/frontend/src/features/chat-background/background.tsx b/studio/frontend/src/features/chat-background/background.tsx
index 8a18941c06f..ba9e2f5ef0e 100644
--- a/studio/frontend/src/features/chat-background/background.tsx
+++ b/studio/frontend/src/features/chat-background/background.tsx
@@ -16,7 +16,7 @@ import {
fadeKey,
visibilityKey,
} from "./model";
-import { useMaterialStore } from "./material";
+import { useAppliedMaterial } from "./material";
import { ComposerGlassLenses } from "./lens";
import { type ImageTone, glassReadability, measureTone } from "./tone";
@@ -221,7 +221,7 @@ export function ChatBackground({ active = true }: { active?: boolean }) {
[],
);
const shownReady = Boolean(value && active && frames.current);
- const glass = useMaterialStore((s) => s.material !== "solid");
+ const glass = useAppliedMaterial() !== "solid";
const [appWallpaper, setAppWallpaper] = useState<HTMLDivElement | null>(null);
const [tone, setTone] = useState<ImageTone | null>(null);
const frameUrl = frames.current?.url;
diff --git a/studio/frontend/src/features/chat-background/controls.tsx b/studio/frontend/src/features/chat-background/controls.tsx
index 6e26612bdfa..682ef814e51 100644
--- a/studio/frontend/src/features/chat-background/controls.tsx
+++ b/studio/frontend/src/features/chat-background/controls.tsx
@@ -138,6 +138,7 @@ export function GlassControls() {
{on && (
<>
<GlassStyleRow />
+ <GlassScopeRow />
<MaterialStrengthRow />
<LensRow />
<MaterialMenusRow />
@@ -146,6 +147,29 @@ export function GlassControls() {
</SettingsSection>
);
}
+function GlassScopeRow() {
+ const t = useT();
+ const { scope, setScope } = useMaterialStore();
+ return (
+ <SettingsRow label={t("chatBackground.scope")}>
+ <Select
+ value={scope}
+ onValueChange={(next) => setScope(next as BackgroundScope)}
+ >
+ <SelectTrigger aria-label={t("chatBackground.scope")} className="w-52">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {SCOPES.map((option) => (
+ <SelectItem key={option} value={option}>
+ {t(scopeLabels[option])}
+ </SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </SettingsRow>
+ );
+}
function MaterialMenusRow() {
const t = useT();
const { material, menus, setMenus } = useMaterialStore();
diff --git a/studio/frontend/src/features/chat-background/lens.tsx b/studio/frontend/src/features/chat-background/lens.tsx
index 4efa22ab2d6..2e153085057 100644
--- a/studio/frontend/src/features/chat-background/lens.tsx
+++ b/studio/frontend/src/features/chat-background/lens.tsx
@@ -3,7 +3,7 @@
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import { createPortal } from "react-dom";
-import { useMaterialStore } from "./material";
+import { useAppliedMaterial, useMaterialStore } from "./material";
import { LENS_SCALE, lensDrawn } from "./model";
const COMPOSER = ".unsloth-composer-surface";
@@ -14,7 +14,7 @@ export function ComposerGlassLenses({
}: {
wallpaper: HTMLElement | null;
}) {
- const material = useMaterialStore((s) => s.material);
+ const material = useAppliedMaterial();
const lens = useMaterialStore((s) => s.lens);
const [hosts, setHosts] = useState<HTMLElement[]>([]);
const workspace = wallpaper?.parentElement ?? null;
diff --git a/studio/frontend/src/features/chat-background/material.ts b/studio/frontend/src/features/chat-background/material.ts
index 70552494246..7760e4c3ee3 100644
--- a/studio/frontend/src/features/chat-background/material.ts
+++ b/studio/frontend/src/features/chat-background/material.ts
@@ -6,7 +6,7 @@ import { isMacPlatform } from "@/features/settings/lib/keyboard-shortcuts";
// eslint-disable-next-line no-restricted-imports
import { useTheme } from "@/features/settings/stores/theme-store";
import { isTauri } from "@/lib/api-base";
-import { useEffect } from "react";
+import { useEffect, useState } from "react";
import { create } from "zustand";
import {
type StateStorage,
@@ -14,15 +14,20 @@ import {
persist,
} from "zustand/middleware";
import {
+ type BackgroundRoute,
+ type BackgroundScope,
DEFAULT_GLASS_STRENGTH,
type GlassStrengths,
type LensMode,
type WindowMaterial,
+ inScope,
sanitizeLens,
sanitizeMaterial,
+ sanitizeScope,
sanitizeStrength,
sanitizeStrengths,
} from "./model";
+import { useChatWelcomeShown } from "./welcome";
export const MATERIAL_STORAGE_KEY = "unsloth_window_material";
@@ -67,11 +72,15 @@ export const useMaterialStore = create<{
menus: boolean;
strength: GlassStrengths;
lens: LensMode;
+ scope: BackgroundScope;
+ /** Not persisted: whether the current route is inside scope, set by WindowMaterialMount. */
+ here: boolean;
setMaterial: (material: WindowMaterial) => void;
setEnabled: (enabled: boolean) => void;
setMenus: (menus: boolean) => void;
setStrength: (strength: number, mode: keyof GlassStrengths) => void;
setLens: (lens: LensMode) => void;
+ setScope: (scope: BackgroundScope) => void;
}>()(
persist(
(set) => ({
@@ -81,6 +90,8 @@ export const useMaterialStore = create<{
menus: true,
strength: DEFAULT_GLASS_STRENGTH,
lens: "off",
+ scope: "all",
+ here: true,
setMaterial: (material) => {
const next = sanitizeMaterial(material);
set(
@@ -100,6 +111,7 @@ export const useMaterialStore = create<{
strength: { ...s.strength, [mode]: sanitizeStrength(strength) },
})),
setLens: (lens) => set({ lens: sanitizeLens(lens) }),
+ setScope: (scope) => set({ scope: sanitizeScope(scope, "all") }),
}),
{
name: MATERIAL_STORAGE_KEY,
@@ -110,6 +122,7 @@ export const useMaterialStore = create<{
menus: s.menus,
strength: s.strength,
lens: s.lens,
+ scope: s.scope,
}),
merge: (persisted, current) => {
const stored = persisted as
@@ -119,6 +132,7 @@ export const useMaterialStore = create<{
menus?: unknown;
strength?: unknown;
lens?: unknown;
+ scope?: unknown;
}
| undefined;
return {
@@ -131,6 +145,8 @@ export const useMaterialStore = create<{
menus: typeof stored?.menus === "boolean" ? stored.menus : true,
strength: sanitizeStrengths(stored?.strength),
lens: sanitizeLens(stored?.lens),
+ // Glass applied everywhere before the setting existed.
+ scope: sanitizeScope(stored?.scope, "all"),
};
},
},
@@ -142,6 +158,11 @@ async function setNativeVibrancy(enabled: boolean): Promise<boolean> {
return invoke<boolean>("set_native_vibrancy", { enabled });
}
+/** The material drawn on this route: solid outside the glass scope. */
+export function useAppliedMaterial(): WindowMaterial {
+ return useMaterialStore((s) => (s.here ? s.material : "solid"));
+}
+
export function useGlassStrength(): number {
const { resolved } = useTheme();
return useMaterialStore((s) => s.strength[resolved]);
@@ -149,10 +170,27 @@ export function useGlassStrength(): number {
let nativeApplied = false;
-export function WindowMaterialMount() {
+export function WindowMaterialMount({ route }: { route?: BackgroundRoute }) {
const material = useMaterialStore((s) => s.material);
const menus = useMaterialStore((s) => s.menus);
+ const scope = useMaterialStore((s) => s.scope);
+ const welcome = useChatWelcomeShown();
const strength = useGlassStrength();
+ // What the native shell settled on; the attribute also needs this route to be in scope.
+ const [shown, setShown] = useState<WindowMaterial>("solid");
+ const here =
+ !route || inScope(scope, route === "chat" && welcome ? "newChat" : route);
+ useEffect(() => {
+ useMaterialStore.setState({ here });
+ }, [here]);
+ useEffect(() => {
+ const root = document.documentElement;
+ const applied = shown === "solid" || !here ? null : shown;
+ // Transparent is the plain theme with see-through fills, so it takes none of the frosted glass rules.
+ if (applied && applied !== "transparent") root.setAttribute("data-glass", applied);
+ else root.removeAttribute("data-glass");
+ root.toggleAttribute("data-glass-clear", applied === "transparent");
+ }, [shown, here]);
useEffect(() => {
const root = document.documentElement;
const blur =
@@ -166,23 +204,23 @@ export function WindowMaterialMount() {
root.style.setProperty("--glass-strength", blur.toFixed(3));
root.style.setProperty("--glass-opacity", opacity.toFixed(3));
}
+ if (material === "transparent") {
+ root.style.setProperty("--glass-fill-alpha", `${strength}%`);
+ } else {
+ root.style.removeProperty("--glass-fill-alpha");
+ }
}, [strength, material]);
useEffect(() => {
document.documentElement.toggleAttribute(
"data-glass-menus",
- menus && material !== "solid",
+ menus && material !== "solid" && material !== "transparent" && here,
);
- }, [menus, material]);
+ }, [menus, material, here]);
useEffect(() => {
- const root = document.documentElement;
const wantsNative = material === "macos" && nativeMaterialAvailable();
let cancelled = false;
- const show = (value: WindowMaterial) => {
- if (value === "solid") root.removeAttribute("data-glass");
- else root.setAttribute("data-glass", value);
- };
if (!wantsNative) {
- show(material === "macos" ? "solid" : material);
+ setShown(material === "macos" ? "solid" : material);
if (nativeApplied) {
nativeApplied = false;
void setNativeVibrancy(false).catch(() => undefined);
@@ -201,11 +239,11 @@ export function WindowMaterialMount() {
}
if (!applied) throw new Error("unsupported");
nativeApplied = true;
- show("macos");
+ setShown("macos");
})
.catch(() => {
if (cancelled) return;
- show("solid");
+ setShown("solid");
useMaterialStore.setState({ nativeFailed: true });
});
return () => {
diff --git a/studio/frontend/src/features/chat-background/model.ts b/studio/frontend/src/features/chat-background/model.ts
index 77c9d47485b..55aa3d41d5c 100644
--- a/studio/frontend/src/features/chat-background/model.ts
+++ b/studio/frontend/src/features/chat-background/model.ts
@@ -4,6 +4,20 @@
// On "all" the sidebar stays solid.
export const SCOPES = ["newChat", "chats", "all"] as const;
export type BackgroundScope = (typeof SCOPES)[number];
+export type BackgroundRoute = "newChat" | "chat" | "page";
+export function sanitizeScope(
+ value: unknown,
+ fallback: BackgroundScope,
+): BackgroundScope {
+ return SCOPES.includes(value as BackgroundScope)
+ ? (value as BackgroundScope)
+ : fallback;
+}
+export function inScope(scope: BackgroundScope, route: BackgroundRoute): boolean {
+ if (scope === "all") return true;
+ if (scope === "chats") return route !== "page";
+ return route === "newChat";
+}
export const EFFECTS = [
"None",
diff --git a/studio/frontend/src/features/chat-background/mount.tsx b/studio/frontend/src/features/chat-background/mount.tsx
index 6456b088248..b3b007b312c 100644
--- a/studio/frontend/src/features/chat-background/mount.tsx
+++ b/studio/frontend/src/features/chat-background/mount.tsx
@@ -1,17 +1,9 @@
// SPDX-License-Identifier: AGPL-3.0-only
import { lazy, Suspense } from "react";
-import type { BackgroundScope } from "./model";
-import { useMaterialStore } from "./material";
+import { useAppliedMaterial } from "./material";
+import { inScope } from "./model";
import { useChatBackground } from "./storage";
import { useChatWelcomeShown } from "./welcome";
-function inScope(
- scope: BackgroundScope,
- route: "newChat" | "chat" | "page",
-): boolean {
- if (scope === "all") return true;
- if (scope === "chats") return route !== "page";
- return route === "newChat";
-}
const Renderer = lazy(() =>
import("./background").then((module) => ({ default: module.ChatBackground })),
);
@@ -31,15 +23,15 @@ export function ChatBackground({
}) {
const { value, ready } = useChatBackground();
const welcome = useChatWelcomeShown();
- const material = useMaterialStore((s) => s.material);
+ const material = useAppliedMaterial();
if (!active) return null;
const shown =
value &&
image &&
(!route || inScope(value.scope, route === "chat" && welcome ? "newChat" : route));
if (!shown)
- // Glass on the chat routes still needs a ready canvas when no image shows there.
- return backdrop && ready && material !== "solid" && material !== "macos" && route !== "page" ? (
+ // Glass still needs a ready canvas on any route where no image shows.
+ return backdrop && ready && material !== "solid" && material !== "macos" ? (
<Suspense fallback={null}>
<Backdrop />
</Suspense>
diff --git a/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx b/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
index 26b40ef3dd3..0f5a751c99b 100644
--- a/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
+++ b/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
@@ -69,6 +69,10 @@ import {
useTheme,
} from "../stores/theme-store";
import { COLOR_THEMES } from "../lib/color-themes";
+import {
+ GLASS_ELEMENT_OUTLINE,
+ useThemeElementOutline,
+} from "../lib/element-outline-default";
import { ColorPickerSwatch } from "./color-picker";
import { normalizeSizeInputDraft } from "./size-input-value";
@@ -987,6 +991,41 @@ export function ContrastSliderRow() {
);
}
+export function ElementOutlineSliderRow() {
+ const t = useT();
+ const { resolved } = useTheme();
+ const outline = useAppearanceCustomStore((s) => s.customization.elementOutline);
+ const patch = useAppearanceCustomStore((s) => s.patch);
+ // Unset starts at the theme's own strength, so the first drag does not jump.
+ const themeOutline = useThemeElementOutline(outline === null);
+ const value = outline ?? themeOutline ?? GLASS_ELEMENT_OUTLINE[resolved];
+ const set = (next: number) => patch({ elementOutline: next });
+ const label = t("settings.appearance.custom.elementOutline.label");
+ return (
+ <div className="flex w-64 items-center gap-3">
+ <Slider
+ value={[value]}
+ min={0}
+ max={100}
+ step={1}
+ onValueChange={(values: number[]) => set(values[0])}
+ aria-label={label}
+ />
+ <NumericValueInput
+ value={value}
+ min={0}
+ max={100}
+ step={1}
+ onChange={set}
+ ariaLabel={label}
+ className="panel-field h-8 w-[calc(84px*var(--ui-space-scale,1))] shrink-0"
+ fixedWidth={true}
+ size={4}
+ />
+ </div>
+ );
+}
+
export function ComposerOutlineSliderRow() {
const t = useT();
const outline = useAppearanceCustomStore((s) => s.customization.composerOutline);
diff --git a/studio/frontend/src/features/settings/components/color-theme-select.tsx b/studio/frontend/src/features/settings/components/color-theme-select.tsx
index 21d86a0bfb9..3550d3ead9d 100644
--- a/studio/frontend/src/features/settings/components/color-theme-select.tsx
+++ b/studio/frontend/src/features/settings/components/color-theme-select.tsx
@@ -55,11 +55,12 @@ function ThemeChip({
);
}
+// Light keeps the original frost but on a cool grey base with a firmer rim, so it reads on a white menu.
function GlassChip() {
return (
<span
aria-hidden="true"
- className="size-6 shrink-0 rounded-full border border-black/10 bg-[linear-gradient(135deg,rgb(255_255_255_/_0.85),rgb(255_255_255_/_0.2)_55%,rgb(255_255_255_/_0.55))] shadow-[inset_0_1px_0_rgb(255_255_255_/_0.9)] dark:border-white/20 dark:bg-[linear-gradient(135deg,rgb(255_255_255_/_0.35),rgb(255_255_255_/_0.05)_55%,rgb(255_255_255_/_0.18))]"
+ className="size-6 shrink-0 rounded-full border border-black/20 bg-[#d9dfe8] bg-[linear-gradient(135deg,rgb(255_255_255_/_0.95),rgb(255_255_255_/_0.2)_55%,rgb(255_255_255_/_0.7))] shadow-[inset_0_1px_0_rgb(255_255_255_/_0.9)] dark:border-white/20 dark:bg-transparent dark:bg-[linear-gradient(135deg,rgb(255_255_255_/_0.35),rgb(255_255_255_/_0.05)_55%,rgb(255_255_255_/_0.18))]"
/>
);
}
diff --git a/studio/frontend/src/features/settings/lib/element-outline-default.ts b/studio/frontend/src/features/settings/lib/element-outline-default.ts
new file mode 100644
index 00000000000..d97f269a0dc
--- /dev/null
+++ b/studio/frontend/src/features/settings/lib/element-outline-default.ts
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import { useEffect, useState } from "react";
+
+type ResolvedTheme = "light" | "dark";
+type Rgba = [number, number, number, number];
+
+/** Mirrors the --element-outline fallbacks on the glass rings in index.css. */
+export const GLASS_ELEMENT_OUTLINE: Record<ResolvedTheme, number> = {
+ light: 12,
+ dark: 14,
+};
+
+/** The border as a slider value: how far it sits from the background towards the text colour. */
+export function outlineStrength(
+ border: Rgba,
+ background: Rgba,
+ foreground: Rgba,
+): number {
+ const alpha = border[3];
+ let along = 0;
+ let span = 0;
+ for (let i = 0; i < 3; i++) {
+ const seen = alpha * border[i] + (1 - alpha) * background[i];
+ const axis = foreground[i] - background[i];
+ along += (seen - background[i]) * axis;
+ span += axis * axis;
+ }
+ if (span === 0) {
+ return 0;
+ }
+ return Math.min(100, Math.max(0, Math.round((100 * along) / span)));
+}
+
+// Canvas resolves any CSS colour (oklch, color-mix, color()) to sRGB, which getComputedStyle does not.
+function readColors(tokens: string[]): Rgba[] | null {
+ const context = document
+ .createElement("canvas")
+ .getContext("2d", { willReadFrequently: true });
+ if (!context) {
+ return null;
+ }
+ const probe = document.createElement("span");
+ probe.style.display = "none";
+ document.body.append(probe);
+ try {
+ return tokens.map((token) => {
+ probe.style.color = `var(${token})`;
+ context.clearRect(0, 0, 1, 1);
+ context.fillStyle = "#000";
+ context.fillStyle = getComputedStyle(probe).color;
+ context.fillRect(0, 0, 1, 1);
+ const [r, g, b, a] = context.getImageData(0, 0, 1, 1).data;
+ return [r, g, b, a / 255];
+ });
+ } finally {
+ probe.remove();
+ }
+}
+
+function readThemeOutline(): number | null {
+ const root = document.documentElement;
+ const resolved: ResolvedTheme = root.classList.contains("dark")
+ ? "dark"
+ : "light";
+ const glassEdges =
+ root.hasAttribute("data-glass") &&
+ (root.hasAttribute("data-chat-wallpaper-workspace-ready") ||
+ root.getAttribute("data-glass") === "macos");
+ if (glassEdges) {
+ return GLASS_ELEMENT_OUTLINE[resolved];
+ }
+ const colors = readColors(["--border", "--background", "--foreground"]);
+ return colors ? outlineStrength(colors[0], colors[1], colors[2]) : null;
+}
+
+/** The current theme's own border strength, re-read whenever the theme, palette or glass changes. */
+export function useThemeElementOutline(active: boolean): number | null {
+ const [value, setValue] = useState<number | null>(null);
+ useEffect(() => {
+ if (!active) {
+ return;
+ }
+ const update = () => setValue(readThemeOutline());
+ update();
+ const observer = new MutationObserver(update);
+ observer.observe(document.documentElement, {
+ attributes: true,
+ attributeFilter: [
+ "class",
+ "style",
+ "data-palette",
+ "data-glass",
+ "data-chat-wallpaper-workspace-ready",
+ "data-contrast-adjust",
+ ],
+ });
+ return () => observer.disconnect();
+ }, [active]);
+ return value;
+}
diff --git a/studio/frontend/src/features/settings/settings-search.ts b/studio/frontend/src/features/settings/settings-search.ts
index c53ad252d24..7f318c57154 100644
--- a/studio/frontend/src/features/settings/settings-search.ts
+++ b/studio/frontend/src/features/settings/settings-search.ts
@@ -103,6 +103,7 @@ export const SETTINGS_SEARCH_INDEX: Record<SettingsTab, TranslationKey[]> = {
"settings.appearance.custom.reduceMotion.label",
"settings.appearance.custom.uiFontSize.label",
"settings.appearance.custom.interfaceScale.label",
+ "settings.appearance.custom.elementOutline.label",
"settings.appearance.custom.codeFontSize.label",
"settings.appearance.custom.fontSmoothing.label",
"settings.appearance.layout.compactSidebar",
diff --git a/studio/frontend/src/features/settings/stores/appearance-custom-store.ts b/studio/frontend/src/features/settings/stores/appearance-custom-store.ts
index f73d466a5a9..243fc0c3144 100644
--- a/studio/frontend/src/features/settings/stores/appearance-custom-store.ts
+++ b/studio/frontend/src/features/settings/stores/appearance-custom-store.ts
@@ -232,6 +232,8 @@ export type AppearanceCustomization = {
contrast: number;
/** 0–100; null = the background image's own outline, or none without one. */
composerOutline: number | null;
+ /** 0–100; null = each theme's own borders. */
+ elementOutline: number | null;
pointerCursors: boolean;
reduceMotion: ReduceMotionSetting;
/** true = the app default (antialiased). */
@@ -264,6 +266,7 @@ export const DEFAULT_CUSTOMIZATION: AppearanceCustomization = {
codeFontSize: null,
contrast: 50,
composerOutline: null,
+ elementOutline: null,
pointerCursors: false,
reduceMotion: "off",
fontSmoothing: true,
@@ -335,6 +338,9 @@ function sanitizeSize(
return rounded;
}
+const sanitizePercent = (value: unknown) =>
+ sanitizeSize(value, { min: 0, max: 100 });
+
function sanitizeModeColors(value: unknown): CustomModeColors {
const source = (value ?? {}) as Partial<CustomModeColors>;
return {
@@ -468,11 +474,8 @@ export function sanitizeCustomization(value: unknown): AppearanceCustomization {
uiFontSize: sanitizeSize(source.uiFontSize, UI_FONT_SIZE_RANGE),
codeFontSize: sanitizeSize(source.codeFontSize, CODE_FONT_SIZE_RANGE),
contrast,
- composerOutline:
- typeof source.composerOutline === "number" &&
- Number.isFinite(source.composerOutline)
- ? Math.min(100, Math.max(0, Math.round(source.composerOutline)))
- : null,
+ composerOutline: sanitizePercent(source.composerOutline),
+ elementOutline: sanitizePercent(source.elementOutline),
pointerCursors: source.pointerCursors === true,
reduceMotion:
source.reduceMotion === "on" || source.reduceMotion === "system"
@@ -1047,6 +1050,16 @@ export function applyCustomizationToDocument(
"--composer-outline",
c.composerOutline === null ? null : `${c.composerOutline}%`,
);
+ setVar(
+ "--element-outline",
+ c.elementOutline === null ? null : `${c.elementOutline}%`,
+ );
+ // "off" also drops the glass edge, which a 0% ring alone would leave in place.
+ if (c.composerOutline === null) {
+ el.removeAttribute("data-composer-outline");
+ } else {
+ el.setAttribute("data-composer-outline", c.composerOutline > 0 ? "on" : "off");
+ }
el.classList.toggle("pointer-cursors", c.pointerCursors);
el.classList.toggle("force-reduced-motion", c.reduceMotion === "on");
// "off" overrides OS reduced motion; index.css media rules skip html.force-motion.
@@ -1056,7 +1069,7 @@ export function applyCustomizationToDocument(
["data-code-line-numbers", c.codeLineNumbers],
["data-code-wrap", c.codeWordWrap],
["data-code-no-ligatures", !c.codeLigatures],
- ["data-composer-outline", (c.composerOutline ?? 0) > 0],
+ ["data-element-outline", c.elementOutline !== null],
] as const) {
if (on) el.setAttribute(name, "");
else el.removeAttribute(name);
diff --git a/studio/frontend/src/features/settings/tabs/appearance-tab.tsx b/studio/frontend/src/features/settings/tabs/appearance-tab.tsx
index 6c41ae6938d..7c61700863f 100644
--- a/studio/frontend/src/features/settings/tabs/appearance-tab.tsx
+++ b/studio/frontend/src/features/settings/tabs/appearance-tab.tsx
@@ -22,6 +22,7 @@ import {
CodeFontRow,
CodeFontSizeRow,
ComposerOutlineSliderRow,
+ ElementOutlineSliderRow,
ComposerPositionSliderRow,
ContrastSliderRow,
FontSmoothingSwitch,
@@ -247,6 +248,12 @@ export function AppearanceTab() {
>
<InterfaceScaleRow />
</SettingsRow>
+ <SettingsRow
+ label={t("settings.appearance.custom.elementOutline.label")}
+ description={t("settings.appearance.custom.elementOutline.description")}
+ >
+ <ElementOutlineSliderRow />
+ </SettingsRow>
<GreetingSettingsRows />
<SettingsRow
label={t("settings.appearance.custom.pointerCursors.label")}
diff --git a/studio/frontend/src/i18n/locales/ar.ts b/studio/frontend/src/i18n/locales/ar.ts
index 207564c85ba..4cc30bd27f5 100644
--- a/studio/frontend/src/i18n/locales/ar.ts
+++ b/studio/frontend/src/i18n/locales/ar.ts
@@ -2501,6 +2501,10 @@ export const ar = {
contrast: {
label: "التباين",
},
+ elementOutline: {
+ label: "حدود العناصر",
+ description: "قوة الحدود حول الأزرار والحقول والبطاقات والقوائم.",
+ },
reduceMotion: {
label: "تقليل الحركة",
description: "قلّل الرسوم المتحركة أو اتبع إعداد نظامك.",
diff --git a/studio/frontend/src/i18n/locales/cs.ts b/studio/frontend/src/i18n/locales/cs.ts
index d6fc3926208..b7963f0af2c 100644
--- a/studio/frontend/src/i18n/locales/cs.ts
+++ b/studio/frontend/src/i18n/locales/cs.ts
@@ -2717,6 +2717,10 @@ export const cs = {
contrast: {
label: "Kontrast",
},
+ elementOutline: {
+ label: "Obrys prvků",
+ description: "Síla okrajů tlačítek, polí, karet a nabídek.",
+ },
reduceMotion: {
label: "Omezit pohyb",
description: "Omezit animace, nebo se řídit systémem.",
diff --git a/studio/frontend/src/i18n/locales/de.ts b/studio/frontend/src/i18n/locales/de.ts
index 7d5d51ebc20..51b0a208253 100644
--- a/studio/frontend/src/i18n/locales/de.ts
+++ b/studio/frontend/src/i18n/locales/de.ts
@@ -2530,6 +2530,10 @@ export const de = {
contrast: {
label: "Kontrast",
},
+ elementOutline: {
+ label: "Umrandung der Elemente",
+ description: "Stärke der Ränder von Schaltflächen, Feldern, Karten und Menüs.",
+ },
reduceMotion: {
label: "Bewegung reduzieren",
description: "Animationen reduzieren oder Systemeinstellung übernehmen.",
diff --git a/studio/frontend/src/i18n/locales/en.ts b/studio/frontend/src/i18n/locales/en.ts
index a30f563f38b..6f7e7bba387 100644
--- a/studio/frontend/src/i18n/locales/en.ts
+++ b/studio/frontend/src/i18n/locales/en.ts
@@ -2518,6 +2518,10 @@ export const en = {
contrast: {
label: "Contrast",
},
+ elementOutline: {
+ label: "Element outline",
+ description: "Border strength for buttons, fields, cards and menus.",
+ },
reduceMotion: {
label: "Reduce motion",
description: "Reduce animations or match your system.",
diff --git a/studio/frontend/src/i18n/locales/es-419.ts b/studio/frontend/src/i18n/locales/es-419.ts
index 8a1a312b8cc..5bdad86c9cc 100644
--- a/studio/frontend/src/i18n/locales/es-419.ts
+++ b/studio/frontend/src/i18n/locales/es-419.ts
@@ -2738,6 +2738,10 @@ export const es419 = {
contrast: {
label: "Contraste",
},
+ elementOutline: {
+ label: "Contorno de los elementos",
+ description: "Intensidad del borde de botones, campos, tarjetas y menús.",
+ },
reduceMotion: {
label: "Reducir el movimiento",
description:
diff --git a/studio/frontend/src/i18n/locales/es.ts b/studio/frontend/src/i18n/locales/es.ts
index d70e206e7ce..1c5bdf2edf9 100644
--- a/studio/frontend/src/i18n/locales/es.ts
+++ b/studio/frontend/src/i18n/locales/es.ts
@@ -2525,6 +2525,10 @@ export const es = {
contrast: {
label: "Contraste",
},
+ elementOutline: {
+ label: "Contorno de los elementos",
+ description: "Intensidad del borde de botones, campos, tarjetas y menús.",
+ },
reduceMotion: {
label: "Reducir el movimiento",
description: "Reduce las animaciones o sigue la configuración del sistema.",
diff --git a/studio/frontend/src/i18n/locales/fa.ts b/studio/frontend/src/i18n/locales/fa.ts
index c41d90302f5..fbdf2f09b29 100644
--- a/studio/frontend/src/i18n/locales/fa.ts
+++ b/studio/frontend/src/i18n/locales/fa.ts
@@ -2689,6 +2689,10 @@ export const fa = {
contrast: {
label: "کنتراست",
},
+ elementOutline: {
+ label: "حاشیهٔ عناصر",
+ description: "شدت حاشیهٔ دکمه‌ها، فیلدها، کارت‌ها و منوها.",
+ },
reduceMotion: {
label: "کاهش حرکت",
description: "کاهش پویانمایی‌ها یا پیروی از سیستم.",
diff --git a/studio/frontend/src/i18n/locales/fr.ts b/studio/frontend/src/i18n/locales/fr.ts
index ba0b7fb4bba..1b11fe1d842 100644
--- a/studio/frontend/src/i18n/locales/fr.ts
+++ b/studio/frontend/src/i18n/locales/fr.ts
@@ -2528,6 +2528,10 @@ export const fr = {
contrast: {
label: "Contraste",
},
+ elementOutline: {
+ label: "Contour des éléments",
+ description: "Intensité des bordures des boutons, champs, cartes et menus.",
+ },
reduceMotion: {
label: "Réduire les animations",
description: "Réduire les animations ou suivre votre système.",
diff --git a/studio/frontend/src/i18n/locales/he.ts b/studio/frontend/src/i18n/locales/he.ts
index e078ce1bf7a..16400d45b63 100644
--- a/studio/frontend/src/i18n/locales/he.ts
+++ b/studio/frontend/src/i18n/locales/he.ts
@@ -2556,6 +2556,10 @@ export const he = {
contrast: {
label: "ניגודיות",
},
+ elementOutline: {
+ label: "מתאר רכיבים",
+ description: "עוצמת הגבול של כפתורים, שדות, כרטיסים ותפריטים.",
+ },
reduceMotion: {
label: "הפחתת תנועה",
description: "הפחת אנימציות או התאם להגדרות המערכת.",
diff --git a/studio/frontend/src/i18n/locales/hi.ts b/studio/frontend/src/i18n/locales/hi.ts
index 748f165ecc9..2059fe0fe25 100644
--- a/studio/frontend/src/i18n/locales/hi.ts
+++ b/studio/frontend/src/i18n/locales/hi.ts
@@ -2507,6 +2507,10 @@ export const hi = {
contrast: {
label: "कंट्रास्ट",
},
+ elementOutline: {
+ label: "तत्वों की आउटलाइन",
+ description: "बटन, फ़ील्ड, कार्ड और मेनू की बॉर्डर की तीव्रता।",
+ },
reduceMotion: {
label: "एनिमेशन कम करें",
description: "एनिमेशन कम करें या सिस्टम सेटिंग का पालन करें।",
diff --git a/studio/frontend/src/i18n/locales/id.ts b/studio/frontend/src/i18n/locales/id.ts
index 5265294ece8..bd017f1c194 100644
--- a/studio/frontend/src/i18n/locales/id.ts
+++ b/studio/frontend/src/i18n/locales/id.ts
@@ -2701,6 +2701,10 @@ export const id = {
contrast: {
label: "Kontras",
},
+ elementOutline: {
+ label: "Garis tepi elemen",
+ description: "Kekuatan garis tepi tombol, kolom, kartu, dan menu.",
+ },
reduceMotion: {
label: "Kurangi gerakan",
description: "Kurangi animasi atau ikuti sistem Anda.",
diff --git a/studio/frontend/src/i18n/locales/it.ts b/studio/frontend/src/i18n/locales/it.ts
index f540f77d71c..1d4cce6332e 100644
--- a/studio/frontend/src/i18n/locales/it.ts
+++ b/studio/frontend/src/i18n/locales/it.ts
@@ -2430,6 +2430,10 @@ export const it = {
contrast: {
label: "Contrasto",
},
+ elementOutline: {
+ label: "Contorno degli elementi",
+ description: "Intensità del bordo di pulsanti, campi, schede e menu.",
+ },
reduceMotion: {
label: "Riduci le animazioni",
description: "Riduci le animazioni o segui il sistema.",
diff --git a/studio/frontend/src/i18n/locales/ja.ts b/studio/frontend/src/i18n/locales/ja.ts
index bc9e8e0c8d7..47cd00f02c5 100644
--- a/studio/frontend/src/i18n/locales/ja.ts
+++ b/studio/frontend/src/i18n/locales/ja.ts
@@ -2482,6 +2482,10 @@ export const ja = {
contrast: {
label: "コントラスト",
},
+ elementOutline: {
+ label: "要素の枠線",
+ description: "ボタン、入力欄、カード、メニューの枠線の濃さ。",
+ },
reduceMotion: {
label: "モーションを減らす",
description: "アニメーションを減らすか、システム設定に従います。",
diff --git a/studio/frontend/src/i18n/locales/ko.ts b/studio/frontend/src/i18n/locales/ko.ts
index 83caa25ec30..7c592ed7fdb 100644
--- a/studio/frontend/src/i18n/locales/ko.ts
+++ b/studio/frontend/src/i18n/locales/ko.ts
@@ -2495,6 +2495,10 @@ export const ko = {
contrast: {
label: "대비",
},
+ elementOutline: {
+ label: "요소 윤곽선",
+ description: "버튼, 입력란, 카드, 메뉴의 테두리 강도입니다.",
+ },
reduceMotion: {
label: "동작 줄이기",
description: "애니메이션을 줄이거나 시스템 설정을 따릅니다.",
diff --git a/studio/frontend/src/i18n/locales/nl.ts b/studio/frontend/src/i18n/locales/nl.ts
index a55ed46df0b..7de8e9e202b 100644
--- a/studio/frontend/src/i18n/locales/nl.ts
+++ b/studio/frontend/src/i18n/locales/nl.ts
@@ -2737,6 +2737,10 @@ export const nl = {
contrast: {
label: "Contrast",
},
+ elementOutline: {
+ label: "Omlijning van elementen",
+ description: "Sterkte van de randen van knoppen, velden, kaarten en menu's.",
+ },
reduceMotion: {
label: "Beweging beperken",
description: "Animaties beperken of je systeem volgen.",
diff --git a/studio/frontend/src/i18n/locales/pl.ts b/studio/frontend/src/i18n/locales/pl.ts
index 38c0fdbc810..6b759186373 100644
--- a/studio/frontend/src/i18n/locales/pl.ts
+++ b/studio/frontend/src/i18n/locales/pl.ts
@@ -2733,6 +2733,10 @@ export const pl = {
contrast: {
label: "Kontrast",
},
+ elementOutline: {
+ label: "Obramowanie elementów",
+ description: "Intensywność obramowania przycisków, pól, kart i menu.",
+ },
reduceMotion: {
label: "Ogranicz ruch",
description: "Ogranicz animacje lub dopasuj do ustawień systemu.",
diff --git a/studio/frontend/src/i18n/locales/pt-br.ts b/studio/frontend/src/i18n/locales/pt-br.ts
index ad1bb48e22d..b23d866a50e 100644
--- a/studio/frontend/src/i18n/locales/pt-br.ts
+++ b/studio/frontend/src/i18n/locales/pt-br.ts
@@ -2514,6 +2514,10 @@ export const ptBR = {
contrast: {
label: "Contraste",
},
+ elementOutline: {
+ label: "Contorno dos elementos",
+ description: "Intensidade da borda de botões, campos, cartões e menus.",
+ },
reduceMotion: {
label: "Reduzir movimento",
description: "Reduza as animações ou siga o sistema.",
diff --git a/studio/frontend/src/i18n/locales/ru.ts b/studio/frontend/src/i18n/locales/ru.ts
index 2167889df8a..04366c839d2 100644
--- a/studio/frontend/src/i18n/locales/ru.ts
+++ b/studio/frontend/src/i18n/locales/ru.ts
@@ -2511,6 +2511,10 @@ export const ru = {
contrast: {
label: "Контраст",
},
+ elementOutline: {
+ label: "Контур элементов",
+ description: "Насыщенность границ кнопок, полей, карточек и меню.",
+ },
reduceMotion: {
label: "Уменьшить анимацию",
description: "Уменьшить анимацию или использовать системную настройку.",
diff --git a/studio/frontend/src/i18n/locales/sv.ts b/studio/frontend/src/i18n/locales/sv.ts
index 09b41281f89..0d55896b0e6 100644
--- a/studio/frontend/src/i18n/locales/sv.ts
+++ b/studio/frontend/src/i18n/locales/sv.ts
@@ -2627,6 +2627,10 @@ export const sv = {
contrast: {
label: "Kontrast",
},
+ elementOutline: {
+ label: "Kontur för element",
+ description: "Styrka på kanterna runt knappar, fält, kort och menyer.",
+ },
reduceMotion: {
label: "Minska rörelse",
description: "Minska animationer eller följ systemet.",
diff --git a/studio/frontend/src/i18n/locales/th.ts b/studio/frontend/src/i18n/locales/th.ts
index db61696d731..585d72f42a3 100644
--- a/studio/frontend/src/i18n/locales/th.ts
+++ b/studio/frontend/src/i18n/locales/th.ts
@@ -2592,6 +2592,10 @@ export const th = {
contrast: {
label: "คอนทราสต์",
},
+ elementOutline: {
+ label: "เส้นขอบองค์ประกอบ",
+ description: "ความเข้มของเส้นขอบปุ่ม ช่องกรอก การ์ด และเมนู",
+ },
reduceMotion: {
label: "ลดการเคลื่อนไหว",
description: "ลดภาพเคลื่อนไหวหรือใช้ตามระบบ",
diff --git a/studio/frontend/src/i18n/locales/tr.ts b/studio/frontend/src/i18n/locales/tr.ts
index 1ffe8aa861d..005dc3a59ed 100644
--- a/studio/frontend/src/i18n/locales/tr.ts
+++ b/studio/frontend/src/i18n/locales/tr.ts
@@ -2693,6 +2693,10 @@ export const tr = {
contrast: {
label: "Kontrast",
},
+ elementOutline: {
+ label: "Öğe çerçevesi",
+ description: "Düğme, alan, kart ve menü kenarlıklarının yoğunluğu.",
+ },
reduceMotion: {
label: "Hareketi azalt",
description: "Animasyonları azaltın veya sisteminize uyun.",
diff --git a/studio/frontend/src/i18n/locales/uk.ts b/studio/frontend/src/i18n/locales/uk.ts
index b1f58faf9a7..cb61d60ae0f 100644
--- a/studio/frontend/src/i18n/locales/uk.ts
+++ b/studio/frontend/src/i18n/locales/uk.ts
@@ -2724,6 +2724,10 @@ export const uk = {
contrast: {
label: "Контраст",
},
+ elementOutline: {
+ label: "Контур елементів",
+ description: "Насиченість меж кнопок, полів, карток і меню.",
+ },
reduceMotion: {
label: "Зменшити рух",
description: "Зменшити анімацію або як у системі.",
diff --git a/studio/frontend/src/i18n/locales/vi.ts b/studio/frontend/src/i18n/locales/vi.ts
index 230a7239b68..887cca76c97 100644
--- a/studio/frontend/src/i18n/locales/vi.ts
+++ b/studio/frontend/src/i18n/locales/vi.ts
@@ -2703,6 +2703,10 @@ export const vi = {
contrast: {
label: "Độ tương phản",
},
+ elementOutline: {
+ label: "Viền phần tử",
+ description: "Độ đậm của viền nút, ô nhập, thẻ và menu.",
+ },
reduceMotion: {
label: "Giảm chuyển động",
description: "Giảm hiệu ứng động hoặc theo hệ thống.",
diff --git a/studio/frontend/src/i18n/locales/zh-CN.ts b/studio/frontend/src/i18n/locales/zh-CN.ts
index 61040d53f46..6652842c3e5 100644
--- a/studio/frontend/src/i18n/locales/zh-CN.ts
+++ b/studio/frontend/src/i18n/locales/zh-CN.ts
@@ -2485,6 +2485,10 @@ export const zhCN = {
contrast: {
label: "对比度",
},
+ elementOutline: {
+ label: "元素轮廓",
+ description: "按钮、输入框、卡片和菜单的边框强度。",
+ },
reduceMotion: {
label: "减少动态效果",
description: "减少动画,或跟随系统设置。",
diff --git a/studio/frontend/src/i18n/locales/zh-TW.ts b/studio/frontend/src/i18n/locales/zh-TW.ts
index fb781214308..271eb5da8ff 100644
--- a/studio/frontend/src/i18n/locales/zh-TW.ts
+++ b/studio/frontend/src/i18n/locales/zh-TW.ts
@@ -2580,6 +2580,10 @@ export const zhTW = {
contrast: {
label: "對比",
},
+ elementOutline: {
+ label: "元素外框",
+ description: "按鈕、輸入欄位、卡片和選單的邊框強度。",
+ },
reduceMotion: {
label: "減少動態效果",
description: "減少動畫,或跟隨系統設定。",
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 088f0b28830..54bf7c053dd 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -6153,9 +6153,15 @@ html[data-chat-compare] :is([data-wallpaper-workspace], [data-chat-content-root]
--composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--composer-outline, var(--wallpaper-outline, 30%)), transparent);
box-shadow: var(--composer-shadow);
}
-/* The Appearance setting draws the same outline without a background image too. */
-html[data-composer-outline] .unsloth-composer-surface {
- --composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--composer-outline), transparent);
+/* The Appearance setting outranks every glass edge, with or without a background image. */
+html[data-composer-outline="on"] :is(.unsloth-composer-surface, .wallpaper-preview-composer) {
+ --composer-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--composer-outline), transparent) !important;
+}
+/* 0 drops every glass edge; solid surfaces keep their drop shadow, which is no outline. */
+html[data-glass="macos"][data-composer-outline="off"] .unsloth-composer-surface,
+html[data-composer-outline="off"] :is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface,
+html[data-composer-outline="off"] .wallpaper-preview-composer {
+ --composer-shadow: none !important;
}
.wallpaper-preview-prose { background: var(--background); }
@@ -6241,6 +6247,7 @@ html {
--glass-page-muted: var(--muted);
--glass-page-secondary: var(--secondary);
--glass-page-input: var(--panel-input-surface);
+ --glass-page-sidebar: var(--sidebar);
}
html { --glass-sidebar-floor: 64%; --glass-pane-tone: 6%; --glass-menu-floor: 80%; --glass-composer-floor: 45%; }
html.dark { --glass-sidebar-floor: 40%; --glass-pane-tone: 0%; --glass-menu-floor: 0%; --glass-composer-floor: 0%; }
@@ -6284,6 +6291,12 @@ html.dark[data-glass="macos"] {
--glass-line: rgb(255 255 255 / .13);
--glass-line-strong: rgb(255 255 255 / .17);
}
+/* Element outline: one border strength over every palette and glass; glass rings read --element-outline too. */
+html[data-element-outline],
+html[data-element-outline] .diffusion-surface {
+ --border-base: color-mix(in srgb, var(--foreground-base) var(--element-outline), transparent) !important;
+ --input-base: color-mix(in srgb, var(--foreground-base) var(--element-outline), transparent) !important;
+}
html:not(.dark):not([data-glass^="liquid"])[data-glass][data-chat-wallpaper-workspace-ready] :is([data-slot="sidebar-inner"], [data-slot="chat-settings-panel"]) {
box-shadow: none;
}
@@ -6310,12 +6323,14 @@ html[data-glass="macos"] [data-slot="sidebar-inner"] :is(.bg-sidebar, .sidebar-s
background-color: transparent;
}
html[data-glass][data-chat-wallpaper-workspace-ready] [data-slot="sidebar-inner"] [data-slot="sidebar-footer-fade"],
-html[data-glass="macos"] [data-slot="sidebar-inner"] [data-slot="sidebar-footer-fade"] {
+html[data-glass="macos"] [data-slot="sidebar-inner"] [data-slot="sidebar-footer-fade"],
+html[data-glass-clear] [data-slot="sidebar-inner"] [data-slot="sidebar-footer-fade"] {
display: none;
}
/* The footer fade paints the opaque sidebar colour, so on glass the list masks its own bottom edge. */
html[data-glass][data-chat-wallpaper-workspace-ready] [data-slot="sidebar-inner"]:has([data-slot="sidebar-footer-fade"][data-visible="true"]) .sidebar-scroll-fade,
-html[data-glass="macos"] [data-slot="sidebar-inner"]:has([data-slot="sidebar-footer-fade"][data-visible="true"]) .sidebar-scroll-fade {
+html[data-glass="macos"] [data-slot="sidebar-inner"]:has([data-slot="sidebar-footer-fade"][data-visible="true"]) .sidebar-scroll-fade,
+html[data-glass-clear] [data-slot="sidebar-inner"]:has([data-slot="sidebar-footer-fade"][data-visible="true"]) .sidebar-scroll-fade {
-webkit-mask-image: linear-gradient(to bottom, var(--sidebar-fade-top, #000) 0, #000 14px, #000 calc(100% - 40px), transparent calc(100% - 8px)),
linear-gradient(var(--sidebar-rail-side, to left), #000 var(--sidebar-rail, 0px), transparent 0);
mask-image: linear-gradient(to bottom, var(--sidebar-fade-top, #000) 0, #000 14px, #000 calc(100% - 40px), transparent calc(100% - 8px)),
@@ -6595,7 +6610,7 @@ html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-route="pag
position: relative;
background-color: color-mix(in srgb, var(--glass-composer-fill) min(96%, calc(max(calc(var(--glass-tint) + 14%), var(--glass-read-floor, 0%), var(--glass-composer-floor)) * var(--glass-opacity, 1))), transparent) !important;
background-image: var(--glass-sheen, none);
- box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) 14%, transparent), inset 0 1px 0 rgb(255 255 255 / .072);
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--element-outline, 14%), transparent), inset 0 1px 0 rgb(255 255 255 / .072);
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
text-shadow: none;
@@ -6623,13 +6638,13 @@ html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-route="pag
html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :where(.elevated-card, [class~="bg-card"], [class*="dark:bg-card"], [data-slot="input"], .panel-field, .field-soft, [data-slot="button"]:is([data-variant="outline"], [data-variant="secondary"]), button:is([data-active="true"][class*="active=true]:bg-"], [aria-current="page"]:is([class^="bg-"], [class*=" bg-"], [class*="dark:bg-"])), .hub-tag-soft, .hub-stat-pill, .hub-tab-toggle, .hub-download-card, .hub-tag-meta, .glass-inset) {
background-color: var(--page-glass-fill, color-mix(in srgb, var(--glass-composer-fill) min(96%, calc(max(calc(var(--glass-tint) + 14%), var(--glass-read-floor, 0%), var(--glass-composer-floor)) * var(--glass-opacity, 1))), transparent));
background-image: var(--glass-sheen, none);
- box-shadow: var(--page-glass-edge, inset 0 0 0 1px color-mix(in srgb, var(--foreground) 14%, transparent), inset 0 1px 0 rgb(255 255 255 / .072));
+ box-shadow: var(--page-glass-edge, inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--element-outline, 14%), transparent), inset 0 1px 0 rgb(255 255 255 / .072));
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}
html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :where(button:not(:disabled, [data-slot="checkbox"], [data-slot="switch"]):is([class*="hover:bg-"]:hover, [class*="open:bg-"][data-state="open"])) {
background-image: linear-gradient(var(--glass-hover), var(--glass-hover)), var(--glass-sheen, linear-gradient(transparent, transparent));
- box-shadow: var(--page-glass-edge, inset 0 0 0 1px color-mix(in srgb, var(--foreground) 14%, transparent), inset 0 1px 0 rgb(255 255 255 / .072));
+ box-shadow: var(--page-glass-edge, inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--element-outline, 14%), transparent), inset 0 1px 0 rgb(255 255 255 / .072));
-webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate));
}
@@ -6652,9 +6667,9 @@ html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-route="pag
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] {
--page-glass-fill: var(--glass-control);
--page-glass-card-fill: rgb(255 255 255 / .45);
- --page-glass-edge: var(--glass-light-inner);
+ --page-glass-edge: var(--glass-light-edge);
--page-glass-rim: var(--page-glass-edge);
- --page-glass-card-edge: var(--glass-light-inner);
+ --page-glass-card-edge: var(--glass-light-edge);
--page-glass-divider: color-mix(in srgb, var(--foreground) 8%, transparent);
}
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :is(.elevated-card, .library-card) {
@@ -6679,19 +6694,16 @@ html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper
html[data-glass][data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :focus-visible:is([class*="focus-visible:ring"]) {
box-shadow: var(--tw-inset-shadow, 0 0 #0000), var(--tw-inset-ring-shadow, 0 0 #0000), var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow, 0 0 #0000) !important;
}
-/* Keep focus and invalid borders. */
-html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :where(.elevated-card, [class~="bg-card"], [class*="dark:bg-card"], [data-slot="input"], .panel-field, .field-soft, [data-slot="button"], .glass-inset, .library-card):not(:focus-visible, [aria-invalid="true"]) {
+/* These draw the ring above instead; keep focus and invalid borders. */
+html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :where(.elevated-card, [class~="bg-card"], [class*="dark:bg-card"], [data-slot="input"], .panel-field, .field-soft, [data-slot="button"], .glass-inset, .library-card, .hub-tag-soft, .hub-stat-pill, .hub-tab-toggle, .hub-download-card, .hub-tag-meta):not(:focus-visible, [aria-invalid="true"]) {
border-color: transparent;
}
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .glass-divider {
border-color: var(--page-glass-divider);
}
-html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :where([class~="border"][class*="rounded"]):not([data-slot="checkbox"], [role="checkbox"], [role="radio"], [role="switch"], :focus-visible, [aria-invalid="true"]) {
- border-color: transparent;
-}
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .api-monitor-page {
--page-glass-card-fill: rgb(255 255 255 / .3);
- --page-glass-card-edge: var(--glass-light-inner);
+ --page-glass-card-edge: var(--glass-light-edge);
}
/* Hide the outer column and row dividers. */
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .api-monitor-page .elevated-card:has(> [class~="bg-card"]) {
@@ -6699,13 +6711,13 @@ html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper
}
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .unsloth-model-selector-trigger {
background-color: var(--glass-control) !important;
- box-shadow: var(--glass-light-inner);
+ box-shadow: var(--glass-light-edge);
}
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-route="page"] > [data-slot="sidebar-inset"] .glass-inset {
- box-shadow: var(--glass-light-inner);
+ box-shadow: var(--glass-light-edge);
}
html:not(.dark)[data-glass][data-chat-wallpaper-ready] [data-chat-model-controls] > :is(.unsloth-model-selector-trigger, [data-chat-model-notice]) {
- box-shadow: var(--glass-light-inner);
+ box-shadow: var(--glass-light-edge);
}
html:not(.dark)[data-glass][data-chat-wallpaper-workspace-ready] [data-slot="sidebar-inner"] {
border-color: transparent;
@@ -6884,13 +6896,18 @@ html[data-glass]:not(.dark) {
--glass-control-pill: rgb(255 255 255 / .55);
--glass-control-rim: inset 0 1px 0 rgb(255 255 255 / .48);
--glass-light-inner: inset 0 1px 1px rgb(255 255 255 / .7), inset 0 16px 30px -20px rgb(255 255 255 / .55), inset 0 -18px 34px -20px rgb(255 255 255 / .4);
+ --glass-light-edge: inset 0 0 0 1px color-mix(in srgb, var(--foreground) var(--element-outline, 12%), transparent), var(--glass-light-inner);
}
html[data-glass][data-glass-menus]:not(.dark) [data-slot="dialog-content"] :is(.hub-tab-toggle, .btn-fill, [data-slot="select-trigger"], [data-slot="dropdown-menu-trigger"][class*="border-border"], [data-variant="picker"]),
html[data-glass][data-chat-wallpaper-workspace-ready]:not(.dark) [data-slot="chat-settings-panel"] :is(.hub-tab-toggle, .btn-fill, [data-slot="select-trigger"], [data-slot="dropdown-menu-trigger"][class*="border-border"], [data-variant="picker"]),
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :is(.hub-tab-toggle, .btn-fill, [data-slot="select-trigger"], [data-slot="dropdown-menu-trigger"][class*="border-border"], [data-variant="picker"]) {
- border-color: transparent;
background-color: var(--glass-control);
}
+/* Borderless fields take the glass ring; !important beats .panel-select-trigger's shadow-none!. */
+html[data-glass][data-glass-menus]:not(.dark) [data-slot="dialog-content"] :is(.panel-field, .panel-select-trigger, .hub-tab-toggle):not(:focus-visible),
+html[data-glass][data-chat-wallpaper-workspace-ready]:not(.dark) [data-slot="chat-settings-panel"] :is(.panel-field, .panel-select-trigger, .hub-tab-toggle):not(:focus-visible) {
+ box-shadow: var(--glass-light-edge) !important;
+}
html[data-glass][data-glass-menus]:not(.dark) [data-slot="dialog-content"] :is(.btn-fill, [data-slot="select-trigger"], [data-slot="dropdown-menu-trigger"][class*="border-border"], [data-variant="picker"]):is(:hover, [data-state="open"]),
html[data-glass][data-chat-wallpaper-workspace-ready]:not(.dark) [data-slot="chat-settings-panel"] :is(.btn-fill, [data-slot="select-trigger"], [data-slot="dropdown-menu-trigger"][class*="border-border"], [data-variant="picker"]):is(:hover, [data-state="open"]),
html[data-glass]:not(.dark)[data-chat-wallpaper-workspace-ready] [data-wallpaper-workspace][data-wallpaper-route="page"] > [data-slot="sidebar-inset"] :is(.btn-fill, [data-slot="select-trigger"], [data-slot="dropdown-menu-trigger"][class*="border-border"], [data-variant="picker"]):is(:hover, [data-state="open"]) {
@@ -7109,3 +7126,59 @@ html[data-glass] :is([data-wallpaper-workspace], [data-chat-content-root]):has(>
:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready][data-outline="false"]) .glass-lens::after {
display: none;
}
+
+/* Transparent glass: the plain theme, every surface in its own colour at the glass strength's
+ opacity, with no shadow or blur. Tokens are redefined on #root from the copies taken on html
+ (a token cannot mix itself), so portalled menus and dialogs stay solid. Sonner renders its
+ toaster inside #root, so it re-resolves the same tokens at full opacity. */
+html[data-glass-clear] #root,
+html[data-glass-clear] #root [data-sonner-toaster] {
+ --clear-alpha: var(--glass-fill-alpha, 50%);
+ --background: color-mix(in srgb, var(--glass-page-bg) var(--clear-alpha), transparent);
+ --card: color-mix(in srgb, var(--glass-page-card) var(--clear-alpha), transparent);
+ --popover: color-mix(in srgb, var(--glass-page-popover) var(--clear-alpha), transparent);
+ --muted: color-mix(in srgb, var(--glass-page-muted) var(--clear-alpha), transparent);
+ --secondary: color-mix(in srgb, var(--glass-page-secondary) var(--clear-alpha), transparent);
+ --sidebar: color-mix(in srgb, var(--glass-page-sidebar) var(--clear-alpha), transparent);
+ --panel-input-surface: color-mix(in srgb, var(--glass-page-input) var(--clear-alpha), transparent);
+ --panel-surface: var(--background);
+ --color-background: var(--background);
+ --color-card: var(--card);
+ --color-popover: var(--popover);
+ --color-muted: var(--muted);
+ --color-secondary: var(--secondary);
+ --color-sidebar: var(--sidebar);
+}
+html[data-glass-clear] #root [data-sonner-toaster] {
+ --clear-alpha: 100%;
+}
+/* text-background labels sit on solid action fills, so they keep the opaque colour. */
+html[data-glass-clear] #root [class*="text-background"] {
+ --background: var(--glass-page-bg);
+ --color-background: var(--glass-page-bg);
+}
+/* At rest nothing scrolls under these headers, so their fill only doubled the page wash into a strip. */
+html[data-glass-clear] #root :is(.library-header-row.sticky:not([data-stuck]), [data-page-model-header]) {
+ background-color: transparent;
+}
+/* Sticky labels repaint the sidebar colour, which would double it up. */
+html[data-glass-clear] #root [data-slot="sidebar-inner"] :is(.bg-sidebar, .sidebar-sticky-label) {
+ background-color: transparent;
+}
+/* In base so this !important outranks layered utilities and unlayered rules alike. */
+@layer base {
+ html[data-glass-clear] body :not(:focus-visible),
+ html[data-glass-clear] body ::before,
+ html[data-glass-clear] body ::after {
+ box-shadow: none !important;
+ text-shadow: none !important;
+ }
+ html[data-glass-clear] #root * {
+ -webkit-backdrop-filter: none !important;
+ backdrop-filter: none !important;
+ }
+ /* The composer hard-codes white in light mode and, over an image, mixes its own wash. */
+ html[data-glass-clear] #root .unsloth-composer-surface {
+ background-color: color-mix(in srgb, var(--glass-page-card) var(--glass-fill-alpha, 50%), transparent) !important;
+ }
+}
diff --git a/studio/frontend/tests/appearance-composer-outline.test.ts b/studio/frontend/tests/appearance-composer-outline.test.ts
index 02c2438ab34..a61fd9a54d7 100644
--- a/studio/frontend/tests/appearance-composer-outline.test.ts
+++ b/studio/frontend/tests/appearance-composer-outline.test.ts
@@ -6,7 +6,7 @@ import test from "node:test";
import { readSrc } from "./helpers/kit.ts";
-const attributes = new Set<string>();
+const attributes = new Map<string, string>();
const vars = new Map<string, string>();
(globalThis as { document?: unknown }).document = {
documentElement: {
@@ -14,9 +14,9 @@ const vars = new Map<string, string>();
setProperty: (name: string, value: string) => vars.set(name, value),
removeProperty: (name: string) => vars.delete(name),
},
- setAttribute: (name: string) => attributes.add(name),
+ setAttribute: (name: string, value: string) => attributes.set(name, value),
removeAttribute: (name: string) => attributes.delete(name),
- toggleAttribute: (name: string, on: boolean) => (on ? attributes.add(name) : attributes.delete(name)),
+ toggleAttribute: (name: string, on: boolean) => (on ? attributes.set(name, "") : attributes.delete(name)),
classList: { toggle() {} },
},
};
@@ -32,22 +32,51 @@ test("records from before the setting keep the background image's own outline",
assert.equal(sanitizeCustomization({ composerOutline: 12.6 }).composerOutline, 13);
});
-test("a set outline reaches every composer, and 0 keeps the theme shadow", () => {
+test("a set outline reaches every composer, and 0 drops the glass edge too", () => {
applyCustomizationToDocument({ ...DEFAULT_CUSTOMIZATION, composerOutline: 40 }, "light");
assert.equal(vars.get("--composer-outline"), "40%");
- assert.ok(attributes.has("data-composer-outline"));
+ assert.equal(attributes.get("data-composer-outline"), "on");
applyCustomizationToDocument({ ...DEFAULT_CUSTOMIZATION, composerOutline: 0 }, "light");
assert.equal(vars.get("--composer-outline"), "0%");
- assert.ok(!attributes.has("data-composer-outline"));
+ assert.equal(attributes.get("data-composer-outline"), "off");
// Unset: off, except the background image's own outline over an image.
applyCustomizationToDocument(DEFAULT_CUSTOMIZATION, "light");
assert.ok(!vars.has("--composer-outline"));
assert.ok(!attributes.has("data-composer-outline"));
const css = readSrc("index.css");
- assert.match(css, /html\[data-composer-outline\] \.unsloth-composer-surface \{\s*--composer-shadow: inset 0 0 0 1px/);
+ // !important: the glass composer rules are more specific and would otherwise keep their 14% ring.
+ assert.match(css, /html\[data-composer-outline="on"\] :is\(\.unsloth-composer-surface, \.wallpaper-preview-composer\) \{\s*--composer-shadow: inset 0 0 0 1px [^;]*var\(--composer-outline\)[^;]*!important;/);
+ // macOS glass has no background image, so its 14% ring needs its own selector.
+ assert.match(css, /html\[data-glass="macos"\]\[data-composer-outline="off"\] \.unsloth-composer-surface,[^{]*\.chat-wallpaper\[data-ready\]\) \.unsloth-composer-surface,[^{]*\{\s*--composer-shadow: none !important;/);
assert.match(css, /var\(--composer-outline, var\(--wallpaper-outline, 30%\)\)/);
});
+test("the element outline sets every border and glass ring, and unset keeps the theme", () => {
+ assert.equal(sanitizeCustomization({}).elementOutline, null);
+ assert.equal(sanitizeCustomization({ elementOutline: -5 }).elementOutline, 0);
+ assert.equal(sanitizeCustomization({ elementOutline: "20" }).elementOutline, null);
+ applyCustomizationToDocument({ ...DEFAULT_CUSTOMIZATION, elementOutline: 0 }, "dark");
+ assert.equal(vars.get("--element-outline"), "0%");
+ assert.ok(attributes.has("data-element-outline"));
+ applyCustomizationToDocument(DEFAULT_CUSTOMIZATION, "dark");
+ assert.ok(!vars.has("--element-outline"));
+ assert.ok(!attributes.has("data-element-outline"));
+ const css = readSrc("index.css");
+ assert.match(css, /html\[data-element-outline\],\s*html\[data-element-outline\] \.diffusion-surface \{\s*--border-base: [^;]*var\(--element-outline\)[^;]*!important;\s*--input-base: [^;]*var\(--element-outline\)[^;]*!important;/);
+ assert.doesNotMatch(css, /color-mix\(in srgb, var\(--foreground\) 14%, transparent\), inset 0 1px 0 rgb\(255 255 255 \/ \.072\)/);
+});
+
+test("light glass outlines its controls by default", () => {
+ const css = readSrc("index.css");
+ assert.match(css, /--glass-light-edge: inset 0 0 0 1px color-mix\(in srgb, var\(--foreground\) var\(--element-outline, 12%\), transparent\), var\(--glass-light-inner\);/);
+ assert.match(css, /--page-glass-edge: var\(--glass-light-edge\);/);
+ assert.doesNotMatch(css, /box-shadow: var\(--glass-light-inner\);/);
+ assert.doesNotMatch(css, /:where\(\[class~="border"\]\[class\*="rounded"\]\)[^{]*\{\s*border-color: transparent;/);
+ const tab = readSrc("features/settings/tabs/appearance-tab.tsx");
+ const preferences = tab.slice(tab.indexOf("preferencesTitle"), tab.indexOf('t("settings.appearance.composer.title")'));
+ assert.ok(preferences.indexOf("<ElementOutlineSliderRow />") > preferences.indexOf("<InterfaceScaleRow />"));
+});
+
test("the composer rows have their own Composer section", () => {
const tab = readSrc("features/settings/tabs/appearance-tab.tsx");
const section = tab.slice(tab.indexOf('t("settings.appearance.composer.title")'));
diff --git a/studio/frontend/tests/element-outline-default.test.ts b/studio/frontend/tests/element-outline-default.test.ts
new file mode 100644
index 00000000000..f697ff1047f
--- /dev/null
+++ b/studio/frontend/tests/element-outline-default.test.ts
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import {
+ GLASS_ELEMENT_OUTLINE,
+ outlineStrength,
+} from "../src/features/settings/lib/element-outline-default.ts";
+import { readSrc } from "./helpers/kit.ts";
+
+const hex = (value: string): [number, number, number, number] => [
+ Number.parseInt(value.slice(1, 3), 16),
+ Number.parseInt(value.slice(3, 5), 16),
+ Number.parseInt(value.slice(5, 7), 16),
+ 1,
+];
+
+test("theme borders map onto the slider's foreground mix", () => {
+ // Standard light #e5e5e5 on #fefefd, dark #3a3a3a on #181818.
+ assert.equal(
+ outlineStrength(hex("#e5e5e5"), hex("#fefefd"), hex("#0f1114")),
+ 10,
+ );
+ assert.equal(
+ outlineStrength(hex("#3a3a3a"), hex("#181818"), hex("#fcfcfc")),
+ 15,
+ );
+ // Blueberry light: a tinted border still lands on its strength.
+ assert.equal(
+ outlineStrength(hex("#abb0c5"), hex("#f6f7fc"), hex("#1c2140")),
+ 33,
+ );
+ // A translucent border is composited over the background first.
+ assert.equal(
+ outlineStrength([15, 17, 20, 0.09], hex("#fefefd"), hex("#0f1114")),
+ 9,
+ );
+ assert.equal(
+ outlineStrength(hex("#fefefd"), hex("#fefefd"), hex("#fefefd")),
+ 0,
+ );
+});
+
+test("the glass defaults match the ring fallbacks in index.css", () => {
+ const css = readSrc("index.css");
+ assert.match(
+ css,
+ new RegExp(`var\\(--element-outline, ${GLASS_ELEMENT_OUTLINE.light}%\\)`),
+ );
+ assert.match(
+ css,
+ new RegExp(`var\\(--element-outline, ${GLASS_ELEMENT_OUTLINE.dark}%\\)`),
+ );
+});
diff --git a/studio/frontend/tests/glass-sidebar-footer.test.ts b/studio/frontend/tests/glass-sidebar-footer.test.ts
index b459267f824..587d0075334 100644
--- a/studio/frontend/tests/glass-sidebar-footer.test.ts
+++ b/studio/frontend/tests/glass-sidebar-footer.test.ts
@@ -10,6 +10,8 @@ const rules = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map((m) => ({ selector:
const GLASS_SIDEBAR = [
'html[data-glass][data-chat-wallpaper-workspace-ready] [data-slot="sidebar-inner"]',
'html[data-glass="macos"] [data-slot="sidebar-inner"]',
+ // Transparent: the sidebar is its own colour at the glass strength, so see-through too.
+ 'html[data-glass-clear] [data-slot="sidebar-inner"]',
];
test("the sidebar footer fade paints nothing over a glass sidebar", () => {
diff --git a/studio/frontend/tests/window-material.test.ts b/studio/frontend/tests/window-material.test.ts
index 645b4a4c357..800496f75f6 100644
--- a/studio/frontend/tests/window-material.test.ts
+++ b/studio/frontend/tests/window-material.test.ts
@@ -4,7 +4,9 @@ import test from "node:test";
import {
MATERIALS,
LENS_SCALE,
+ inScope,
lensDrawn,
+ sanitizeScope,
sanitizeLens,
sanitizeMaterial,
sanitizeStrength,
@@ -18,6 +20,30 @@ test("glass material repairs malformed persisted data", () => {
for (const material of MATERIALS) assert.equal(sanitizeMaterial(material), material);
});
+test("the glass Show on setting keeps old records on every page and maps routes like the background", () => {
+ assert.equal(sanitizeScope(undefined, "all"), "all");
+ assert.equal(sanitizeScope("pages", "all"), "all");
+ assert.equal(sanitizeScope("chats", "all"), "chats");
+ assert.deepEqual(
+ (["newChat", "chat", "page"] as const).map((route) => [inScope("newChat", route), inScope("chats", route), inScope("all", route)]),
+ [[true, true, true], [false, true, true], [false, false, true]],
+ );
+ const material = readFileSync(new URL("../src/features/chat-background/material.ts", import.meta.url), "utf8");
+ assert.match(material, /scope: sanitizeScope\(stored\?\.scope, "all"\)/);
+ // Out of scope the page draws solid: no glass attribute, no glass menus, no lens or plain backdrop.
+ assert.match(material, /const applied = shown === "solid" \|\| !here \? null : shown;/);
+ assert.match(material, /menus && material !== "solid" && material !== "transparent" && here,/);
+ for (const file of ["lens.tsx", "mount.tsx", "background.tsx"]) {
+ const source = readFileSync(new URL(`../src/features/chat-background/${file}`, import.meta.url), "utf8");
+ assert.match(source, /useAppliedMaterial\(\)/, file);
+ }
+ // Pages without the image still get the plain glass canvas; only macOS draws its own.
+ const mount = readFileSync(new URL("../src/features/chat-background/mount.tsx", import.meta.url), "utf8");
+ assert.match(mount, /return backdrop && ready && material !== "solid" && material !== "macos" \? \(/);
+ const root = readFileSync(new URL("../src/app/routes/__root.tsx", import.meta.url), "utf8");
+ assert.match(root, /<WindowMaterialMount route=\{hideNavbar \? undefined : isChatRoute \? "chat" : "page"\} \/>/);
+});
+
test("every glass material has its stylesheet tokens", () => {
const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
for (const material of MATERIALS.filter((m) => m !== "solid")) {
@@ -293,31 +319,32 @@ test("light glass New chat lifts the wallpaper along a curve that still tracks t
assert.ok(lift(0.9) - lift(0.75) > 0.07 && lift(1) === 1 && lift(0) === 0);
});
-test("light glass pages use the white control glass and a lighter card sheet, edged with inner light", () => {
+test("light glass pages use the white control glass and a lighter card sheet, edged with an outline and inner light", () => {
const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
const light = String.raw`html\[data-glass\]:not\(\.dark\)\[data-chat-wallpaper-workspace-ready\] \[data-wallpaper-route="page"\] > \[data-slot="sidebar-inset"\]`;
- assert.match(css, new RegExp(`${light} \\{\\n --page-glass-fill: var\\(--glass-control\\);\\n --page-glass-card-fill: rgb\\(255 255 255 / \\.45\\);\\n --page-glass-edge: var\\(--glass-light-inner\\);`));
+ assert.match(css, new RegExp(`${light} \\{\\n --page-glass-fill: var\\(--glass-control\\);\\n --page-glass-card-fill: rgb\\(255 255 255 / \\.45\\);\\n --page-glass-edge: var\\(--glass-light-edge\\);`));
assert.match(css, new RegExp(`${light} \\.elevated-card > \\[class~="bg-card"\\] \\{\\n background-color: transparent;\\n box-shadow: inset -1px 0 0 var\\(--page-glass-divider\\), inset 0 -1px 0 var\\(--page-glass-divider\\);`));
assert.match(css, new RegExp(`${light} :is\\(\\.elevated-card, \\.library-card\\) \\{\\n box-shadow: var\\(--page-glass-card-edge\\);`));
assert.match(css, new RegExp(`${light} \\.glass-divider \\{\\n border-color: var\\(--page-glass-divider\\);`));
- assert.match(css, new RegExp(`${light} \\.unsloth-model-selector-trigger \\{\\n background-color: var\\(--glass-control\\) !important;\\n box-shadow: var\\(--glass-light-inner\\);`));
+ assert.match(css, new RegExp(`${light} \\.unsloth-model-selector-trigger \\{\\n background-color: var\\(--glass-control\\) !important;\\n box-shadow: var\\(--glass-light-edge\\);`));
const api = readFileSync(new URL("../src/features/api-monitor/api-monitor-page.tsx", import.meta.url), "utf8");
assert.match(api, /const DIVIDER = "glass-divider /);
assert.match(api, /const INSET =\n "glass-inset /);
});
-test("light glass API cards trade the outline for a thinner fill and inner glass light", () => {
+test("light glass API cards use a thinner fill with the outlined glass edge", () => {
const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
- assert.match(css, /html\[data-glass\]:not\(\.dark\)\[data-chat-wallpaper-workspace-ready\] \[data-wallpaper-route="page"\] > \[data-slot="sidebar-inset"\] \.api-monitor-page \{\n --page-glass-card-fill: rgb\(255 255 255 \/ \.3\);\n --page-glass-card-edge: var\(--glass-light-inner\);/);
+ assert.match(css, /html\[data-glass\]:not\(\.dark\)\[data-chat-wallpaper-workspace-ready\] \[data-wallpaper-route="page"\] > \[data-slot="sidebar-inset"\] \.api-monitor-page \{\n --page-glass-card-fill: rgb\(255 255 255 \/ \.3\);\n --page-glass-card-edge: var\(--glass-light-edge\);/);
assert.match(css, /\.api-monitor-page \.elevated-card:has\(> \[class~="bg-card"\]\) \{\n clip-path: inset\(0 1px 1px 0 round var\(--radius-2xl\)\);/);
});
-test("light glass trades grey outlines for inner light on the sidebar, model buttons and status chip", () => {
+test("light glass outlines model buttons and the status chip, but not the sidebar", () => {
const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
assert.match(css, / --glass-light-inner: inset 0 1px 1px rgb\(255 255 255 \/ \.7\), inset 0 16px 30px -20px rgb\(255 255 255 \/ \.55\), inset 0 -18px 34px -20px rgb\(255 255 255 \/ \.4\);/);
assert.match(css, /html:not\(\.dark\)\[data-glass\]\[data-chat-wallpaper-workspace-ready\] \[data-slot="sidebar-inner"\] \{\n border-color: transparent;\n box-shadow: none;/);
- assert.match(css, /html:not\(\.dark\)\[data-glass\]\[data-chat-wallpaper-ready\] \[data-chat-model-controls\] > :is\(\.unsloth-model-selector-trigger, \[data-chat-model-notice\]\) \{\n box-shadow: var\(--glass-light-inner\);/);
- assert.match(css, /\.glass-inset \{\n box-shadow: var\(--glass-light-inner\);/);
+ assert.match(css, /html:not\(\.dark\)\[data-glass\]\[data-chat-wallpaper-ready\] \[data-chat-model-controls\] > :is\(\.unsloth-model-selector-trigger, \[data-chat-model-notice\]\) \{\n box-shadow: var\(--glass-light-edge\);/);
+ assert.match(css, /\.glass-inset \{\n box-shadow: var\(--glass-light-edge\);/);
+ assert.match(css, / --glass-light-edge: inset 0 0 0 1px color-mix\(in srgb, var\(--foreground\) var\(--element-outline, 12%\), transparent\), var\(--glass-light-inner\);/);
});
test("light glass draws no grey outlines outside the composer", () => {
@@ -335,15 +362,15 @@ test("light glass draws no grey outlines outside the composer", () => {
assert.match(css, /html\[data-glass="liquid-3d"\] :is\(\.unsloth-composer-surface, \.unsloth-files-panel, \.wallpaper-preview-composer\) \{\n[^}]*--glass-rim: [^;]*inset 0 0 0 1px/);
});
-test("light glass pages drop outlines from boxed panels but keep checkboxes", () => {
+test("light glass pages keep the borders of boxed panels and select triggers", () => {
const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
- assert.match(css, /:where\(\[class~="border"\]\[class\*="rounded"\]\):not\(\[data-slot="checkbox"\], \[role="checkbox"\], \[role="radio"\], \[role="switch"\], :focus-visible, \[aria-invalid="true"\]\) \{\n border-color: transparent;/);
+ assert.doesNotMatch(css, /:where\(\[class~="border"\]\[class\*="rounded"\]\):not\(\[data-slot="checkbox"\], \[role="checkbox"\], \[role="radio"\], \[role="switch"\], :focus-visible, \[aria-invalid="true"\]\) \{\n border-color: transparent;/);
});
test("light glass border clearing leaves focused and invalid fields their ring border", () => {
const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
const cleared = [...css.matchAll(/([^{}]*)\{\n border-color: transparent;\n\}/g)].map(([, sel]) => sel).filter((sel) => sel.includes('[data-wallpaper-route="page"]') && sel.includes(":not(.dark)"));
- assert.ok(cleared.length >= 2);
+ assert.ok(cleared.length >= 1);
for (const sel of cleared) assert.match(sel, /:focus-visible, \[aria-invalid="true"\]\)/, sel);
});
@@ -353,3 +380,24 @@ test("focused glass surfaces on pages show their Tailwind focus ring over the gl
const cards = readFileSync(new URL("../src/features/library/components/library-cards.tsx", import.meta.url), "utf8");
assert.match(cards, /focus-visible:ring-2/);
});
+
+test("transparent glass keeps each surface's colour at the strength's opacity, with no shadow or blur", () => {
+ const material = readFileSync(new URL("../src/features/chat-background/material.ts", import.meta.url), "utf8");
+ // Its own attribute, so none of the frosted html[data-glass] rules apply on top.
+ assert.match(material, /if \(applied && applied !== "transparent"\) root\.setAttribute\("data-glass", applied\);/);
+ assert.match(material, /root\.toggleAttribute\("data-glass-clear", applied === "transparent"\);/);
+ assert.match(material, /root\.style\.setProperty\("--glass-fill-alpha", `\$\{strength\}%`\);/);
+ const css = readFileSync(new URL("../src/index.css", import.meta.url), "utf8");
+ const block = css.slice(css.indexOf("/* Transparent glass: the plain theme"));
+ // On #root from the html copies: a token cannot mix itself, and portalled overlays stay solid.
+ for (const [token, copy] of [["background", "bg"], ["card", "card"], ["popover", "popover"], ["muted", "muted"], ["secondary", "secondary"], ["sidebar", "sidebar"]]) {
+ assert.match(block, new RegExp(`html\\[data-glass-clear\\] #root,\\nhtml\\[data-glass-clear\\] #root \\[data-sonner-toaster\\] \\{[^}]*--${token}: color-mix\\(in srgb, var\\(--glass-page-${copy}\\) var\\(--clear-alpha\\), transparent\\);`), token);
+ }
+ // Sonner renders inside #root (no portal), so toasts re-resolve the tokens at full opacity.
+ assert.match(block, /html\[data-glass-clear\] #root \[data-sonner-toaster\] \{\n --clear-alpha: 100%;\n\}/);
+ assert.match(block, /html\[data-glass-clear\] #root \[class\*="text-background"\] \{\n --background: var\(--glass-page-bg\);\n --color-background: var\(--glass-page-bg\);\n\}/);
+ assert.match(css, /--glass-page-sidebar: var\(--sidebar\);/);
+ assert.match(block, /html\[data-glass-clear\] #root :is\(\.library-header-row\.sticky:not\(\[data-stuck\]\), \[data-page-model-header\]\) \{\n\s*background-color: transparent;/);
+ assert.match(block, /@layer base \{\n\s*html\[data-glass-clear\] body :not\(:focus-visible\),[^{]*\{\n\s*box-shadow: none !important;\n\s*text-shadow: none !important;/);
+ assert.match(block, /html\[data-glass-clear\] #root \* \{\n\s*-webkit-backdrop-filter: none !important;\n\s*backdrop-filter: none !important;/);
+});