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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: set scrollbar-color in rgb so Reduce motion stops restarting a transition on every element (#17413)
Daniel Hanb44acd882e07
diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.cssindex c79f3a1010a..cb7f21b1332 100644--- a/studio/frontend/src/features/hub/hub.css+++ b/studio/frontend/src/features/hub/hub.css@@ -1533,11 +1533,11 @@}html:not(.dark) .hub-page [data-hub-scroll="true"] {- scrollbar-color: oklch(0.5 0 0 / 0.22) transparent;+ scrollbar-color: rgb(99 99 99 / 0.22) transparent;}html.dark .hub-page [data-hub-scroll="true"] {- scrollbar-color: oklch(0.55 0 0 / 0.16) transparent;+ scrollbar-color: rgb(113 113 113 / 0.16) transparent;}html:not(.dark) .hub-page [data-hub-scroll="true"]::-webkit-scrollbar-thumb {diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex 1c34e9efdde..f7dbc0b9b8d 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -4968,13 +4968,16 @@ html.force-reduced-motion .sidebar-section-drop-line {}}+/* scrollbar-color is set in legacy rgb(), never oklch(): Chromium reads an oklch scrollbar-color back+ as oklab after a transition, so under Reduce motion's 0.01ms `all` transition every restyle starts a+ new one on every element (about 10,000 at 40 turns in Glass). rgb() is the same grey. */* {scrollbar-width: thin;- scrollbar-color: oklch(0.5 0 0 / 0.54) transparent;+ scrollbar-color: rgb(99 99 99 / 0.54) transparent;}.dark * {- scrollbar-color: oklch(0.67 0 0 / 0.5) transparent;+ scrollbar-color: rgb(149 149 149 / 0.5) transparent;}::-webkit-scrollbar {@@ -5323,7 +5326,7 @@ html.force-reduced-motion .sidebar-section-drop-line {/* Faint until hovered, so a tall draft never shows a heavy dark rail. */.composer-input,.unsloth-composer-input {- scrollbar-color: oklch(0.5 0 0 / 0.16) transparent;+ scrollbar-color: rgb(99 99 99 / 0.16) transparent;/* At fractional zoom a 1px overflow otherwise shows a stray scrollbar. */overflow-x: hidden;}@@ -5342,7 +5345,7 @@ html.force-reduced-motion .sidebar-section-drop-line {.dark .composer-input,.dark .unsloth-composer-input {- scrollbar-color: oklch(0.72 0 0 / 0.18) transparent;+ scrollbar-color: rgb(164 164 164 / 0.18) transparent;}.dark .composer-input::-webkit-scrollbar-thumb,@@ -5375,7 +5378,7 @@ html.force-reduced-motion .sidebar-section-drop-line {.run-settings-scroll:hover,.aui-thread-viewport:hover,.hover-scrollbar:hover {- scrollbar-color: oklch(0.5 0 0 / 0.4) transparent;+ scrollbar-color: rgb(99 99 99 / 0.4) transparent;}.sidebar-scroll-fade:hover::-webkit-scrollbar-thumb,@@ -5389,7 +5392,7 @@ html.force-reduced-motion .sidebar-section-drop-line {.dark .run-settings-scroll:hover,.dark .aui-thread-viewport:hover,.dark .hover-scrollbar:hover {- scrollbar-color: oklch(0.72 0 0 / 0.4) transparent;+ scrollbar-color: rgb(164 164 164 / 0.4) transparent;}.dark .sidebar-scroll-fade:hover::-webkit-scrollbar-thumb,@@ -5459,12 +5462,12 @@ html.force-reduced-motion .sidebar-section-drop-line {}:root.client-windows .aui-thread-viewport:hover {- scrollbar-color: oklch(0.5 0 0 / 0.4) transparent !important;+ scrollbar-color: rgb(99 99 99 / 0.4) transparent !important;}.dark:root.client-windows .aui-thread-viewport:hover,:root.client-windows .dark .aui-thread-viewport:hover {- scrollbar-color: oklch(0.72 0 0 / 0.4) transparent !important;+ scrollbar-color: rgb(164 164 164 / 0.4) transparent !important;}@media screen and (forced-colors: none) {diff --git a/studio/frontend/tests/scrollbar-color-legacy-rgb.test.ts b/studio/frontend/tests/scrollbar-color-legacy-rgb.test.tsnew file mode 100644index 00000000000..a67e6f090c0--- /dev/null+++ b/studio/frontend/tests/scrollbar-color-legacy-rgb.test.ts@@ -0,0 +1,61 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// Chromium reads an oklch() scrollbar-color back as oklab() once a transition has run on it, so the+// next restyle sees a "changed" value and starts another one. Reduce motion (on by default) gives+// every element a 0.01ms `all` transition, and `* { scrollbar-color }` covers every element, so in a+// long chat each restyle started thousands of transitions (typing in Liquid Glass at 200 turns:+// about 13,000 elements restyled instead of 1,300). Legacy rgb()/hex values round-trip unchanged.++import assert from "node:assert/strict";+import { readdirSync, readFileSync } from "node:fs";+import path from "node:path";+import test from "node:test";+import { fileURLToPath } from "node:url";++const SRC = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../src");++function cssFiles(dir: string): string[] {+ const out: string[] = [];+ for (const entry of readdirSync(dir, { withFileTypes: true })) {+ const full = path.join(dir, entry.name);+ if (entry.isDirectory()) out.push(...cssFiles(full));+ else if (entry.name.endsWith(".css")) out.push(full);+ }+ return out;+}++const LEGACY = /^(?:auto|transparent|inherit|initial|unset|revert|currentcolor|#[0-9a-f]{3,8}|rgba?\([^()]*\))$/i;++export function nonLegacyScrollbarColors(css: string): string[] {+ const bad: string[] = [];+ for (const m of css.replace(/\/\*[\s\S]*?\*\//g, "").matchAll(/scrollbar-color\s*:\s*([^;}]+)/g)) {+ const value = m[1].replace(/!important/i, "").trim();+ const tokens = value.match(/[a-z-]+\([^()]*\)|#[0-9a-f]+|[a-z-]+/gi) ?? [];+ if (tokens.length === 0 || tokens.some((t) => !LEGACY.test(t))) bad.push(value);+ }+ return bad;+}++test("the checker flags oklch, var() and color-mix, and accepts rgb, hex and keywords", () => {+ assert.deepEqual(nonLegacyScrollbarColors("* { scrollbar-color: oklch(0.5 0 0 / 0.54) transparent; }"), [+ "oklch(0.5 0 0 / 0.54) transparent",+ ]);+ assert.equal(nonLegacyScrollbarColors("a { scrollbar-color: var(--x) transparent }").length, 1);+ assert.equal(nonLegacyScrollbarColors("a { scrollbar-color: color-mix(in srgb, red 5%, blue) red }").length, 1);+ assert.deepEqual(+ nonLegacyScrollbarColors(+ "a { scrollbar-color: rgb(99 99 99 / 0.4) transparent !important; } b { scrollbar-color: auto } c { scrollbar-color: #636363 rgba(0,0,0,0) }",+ ),+ [],+ );+});++test("every scrollbar-color in the Studio stylesheets uses legacy rgb, hex or a keyword", () => {+ const files = cssFiles(SRC);+ assert.ok(files.some((f) => f.endsWith(`${path.sep}index.css`)), "index.css not found under src");+ const offenders = files.flatMap((f) =>+ nonLegacyScrollbarColors(readFileSync(f, "utf8")).map((v) => `${path.relative(SRC, f)}: ${v}`),+ );+ assert.deepEqual(offenders, []);+});