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: one slider look everywhere, filled with the accent (#14471)

Michael Han625522bff3f0
diff --git a/studio/frontend/public/theme-boot.js b/studio/frontend/public/theme-boot.js
index 84e6aae297d..d72eecd39c6 100644
--- a/studio/frontend/public/theme-boot.js
+++ b/studio/frontend/public/theme-boot.js
@@ -32,3 +32,12 @@ try {
root.setAttribute("data-palette", palette);
}
} catch (e) {}
+
+// One screen pixel in CSS px, for slider tracks (index.css); re-run when the zoom changes.
+try {
+ (function px() {
+ var r = devicePixelRatio || 1;
+ document.documentElement.style.setProperty("--device-px", 1 / r + "px");
+ matchMedia("(resolution:" + r + "dppx)").addEventListener("change", px, { once: true });
+ })();
+} catch (e) {}
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.ts
index 341c64b1211..a5f3367f92f 100644
--- a/studio/frontend/scripts/check-bundle-budget.ts
+++ b/studio/frontend/scripts/check-bundle-budget.ts
@@ -320,8 +320,10 @@ export const BUDGET = {
// 6,862,932 B raw, 2,066,441 -> 2,066,440 B transfer against 2aeeceb07e, one machine and build, 96 chunks).
// Merged with main at 2552ee3895 the build measures 6,863,532 B raw / 2,066,692 B transfer (Node 26, 97 chunks).
// Raised to that build plus the same 160 B raw / 189 B transfer margin.
- transferBytes: 2_066_881,
- rawBytes: 6_863_692,
+ // Slider tracks round to whole screen pixels at any zoom: theme-boot.js publishes --device-px before first
+ // paint, 1,501 -> 1,847 B (served uncompressed, so 346 B raw and transfer). Raised by that, same margin.
+ transferBytes: 2_067_227,
+ rawBytes: 6_864_038,
};
// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering the
diff --git a/studio/frontend/src/components/assistant-ui/audio-player.tsx b/studio/frontend/src/components/assistant-ui/audio-player.tsx
index c067af06397..8355e9e9d68 100644
--- a/studio/frontend/src/components/assistant-ui/audio-player.tsx
+++ b/studio/frontend/src/components/assistant-ui/audio-player.tsx
@@ -111,7 +111,11 @@ export const AudioPlayer: FC<AudioPlayerProps> = ({
step={0.01}
value={progress}
onChange={handleSeek}
- className="h-1.5 w-full cursor-pointer accent-primary"
+ className="native-range w-full"
+ style={{
+ ["--range-ratio" as string]:
+ duration > 0 ? Math.min(1, progress / duration) : 0,
+ }}
/>
<div className="flex justify-between text-ui-10 text-muted-foreground">
<span>{formatTime(progress)}</span>
diff --git a/studio/frontend/src/components/ui/slider.tsx b/studio/frontend/src/components/ui/slider.tsx
index 528562dd89d..1227f3d4eab 100644
--- a/studio/frontend/src/components/ui/slider.tsx
+++ b/studio/frontend/src/components/ui/slider.tsx
@@ -6,7 +6,7 @@ import * as React from "react";
import { cn } from "@/lib/utils";
-const THUMB_SIZE_PX = 16;
+const THUMB_SIZE_PX = 20;
function getThumbInBoundsOffset(width: number, percent: number) {
const halfWidth = width / 2;
@@ -59,9 +59,7 @@ function Slider({
);
const isSingleThumbHorizontal =
values.length === 1 && orientation === "horizontal";
- // The thumb follows the UI font size, and .panel-slider resizes it outright,
- // so the fill measures it rather than assuming 16px. offsetWidth ignores the
- // hover/press transforms.
+ // The thumb scales with the UI size, so the fill measures it.
const thumbRef = React.useRef<HTMLSpanElement | null>(null);
const [thumbWidth, setThumbWidth] = React.useState(THUMB_SIZE_PX);
React.useLayoutEffect(() => {
@@ -105,19 +103,19 @@ function Slider({
orientation={orientation}
onValueChange={handleValueChange}
className={cn(
- "data-vertical:min-h-40 relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:w-auto data-vertical:flex-col",
+ "data-horizontal:min-h-(--slider-thumb-size) data-vertical:min-h-40 data-vertical:min-w-(--slider-thumb-size) relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:w-auto data-vertical:flex-col",
className,
)}
{...props}
>
<SliderPrimitive.Track
data-slot="slider-track"
- className="bg-[rgb(0_0_0_/_calc(0.1*var(--contrast-wash-gain,1)))] dark:bg-[rgb(0_0_0_/_calc(0.12*var(--contrast-wash-gain,1)))] rounded-4xl data-horizontal:h-2 data-horizontal:w-full data-vertical:h-full data-vertical:w-2 relative grow overflow-hidden cursor-pointer"
+ className="bg-(--slider-track) rounded-full data-horizontal:h-(--slider-track-height) data-horizontal:w-full data-vertical:h-full data-vertical:w-(--slider-track-height) relative grow overflow-hidden cursor-pointer"
>
<SliderPrimitive.Range
data-slot="slider-range"
className={cn(
- "bg-primary absolute select-none data-horizontal:h-full data-vertical:w-full",
+ "bg-(--slider-fill) absolute select-none data-horizontal:h-full data-vertical:w-full",
isSingleThumbHorizontal && "opacity-0",
)}
/>
@@ -125,8 +123,8 @@ function Slider({
<div
aria-hidden={true}
className={cn(
- "absolute inset-y-0 left-0 bg-primary pointer-events-none",
- fillPercent === 100 ? "rounded-4xl" : "rounded-l-4xl",
+ "absolute inset-y-0 left-0 bg-(--slider-fill) pointer-events-none",
+ fillPercent === 100 ? "rounded-full" : "rounded-l-full",
)}
style={{ width: fillWidth }}
/>
@@ -144,7 +142,7 @@ function Slider({
aria-label={props["aria-label"]}
aria-labelledby={props["aria-labelledby"]}
aria-valuetext={thumbValueText?.(values[index] ?? min, index)}
- className="ring-ring/50 relative z-10 size-4 rounded-4xl bg-white shadow-sm block shrink-0 select-none cursor-pointer disabled:pointer-events-none disabled:opacity-50 transition-transform duration-100 ease-out hover:scale-110 hover:ring-4 active:scale-95 focus-visible:ring-1 focus-visible:outline-hidden"
+ className="ring-(--slider-fill)/30 relative z-10 size-(--slider-thumb-size) rounded-full bg-(--slider-thumb) shadow-(--slider-thumb-shadow) block shrink-0 select-none cursor-pointer disabled:pointer-events-none disabled:opacity-50 focus-visible:ring-4 focus-visible:outline-hidden"
/>
))}
</SliderPrimitive.Root>
diff --git a/studio/frontend/src/features/audio/components/stem-mixer.tsx b/studio/frontend/src/features/audio/components/stem-mixer.tsx
index b1088f3a681..26b10e2848c 100644
--- a/studio/frontend/src/features/audio/components/stem-mixer.tsx
+++ b/studio/frontend/src/features/audio/components/stem-mixer.tsx
@@ -280,7 +280,7 @@ export function StemMixer({
/>
</Button>
<Slider
- className="panel-slider w-[calc(88px*var(--ui-space-scale,1))] px-1"
+ className="w-[calc(88px*var(--ui-space-scale,1))] px-1"
min={0}
max={100}
step={1}
diff --git a/studio/frontend/src/features/browser/video-file.tsx b/studio/frontend/src/features/browser/video-file.tsx
index b1566a6c054..4abe1f76deb 100644
--- a/studio/frontend/src/features/browser/video-file.tsx
+++ b/studio/frontend/src/features/browser/video-file.tsx
@@ -141,7 +141,7 @@ export function VideoFile({
handler();
};
- const progress = duration > 0 ? Math.min(100, (time / duration) * 100) : 0;
+ const progress = duration > 0 ? Math.min(1, time / duration) : 0;
const level = muted ? 0 : volume;
const pipSupported = typeof document !== "undefined" && document.pictureInPictureEnabled;
@@ -220,8 +220,8 @@ export function VideoFile({
const el = video();
if (el) el.currentTime = Number(event.currentTarget.value);
}}
- className="browser-video-range mx-1 min-w-0 flex-1"
- style={{ ["--range-fill" as string]: `${progress}%` }}
+ className="native-range mx-1 min-w-0 flex-1"
+ style={{ ["--range-ratio" as string]: progress }}
/>
<span className="shrink-0 px-1 text-ui-13 text-muted-foreground tabular-nums">
{clock(time)} / {clock(duration)}
@@ -240,8 +240,8 @@ export function VideoFile({
el.volume = Number(event.currentTarget.value);
el.muted = el.volume === 0;
}}
- className="browser-video-range w-0 opacity-0 transition-[width,opacity] duration-150 group-focus-within/volume:mr-1 group-focus-within/volume:w-16 group-focus-within/volume:opacity-100 group-hover/volume:mr-1 group-hover/volume:w-16 group-hover/volume:opacity-100"
- style={{ ["--range-fill" as string]: `${level * 100}%` }}
+ className="native-range w-0 opacity-0 transition-[width,opacity] duration-150 group-focus-within/volume:mr-1 group-focus-within/volume:w-20 group-focus-within/volume:opacity-100 group-hover/volume:mr-1 group-hover/volume:w-20 group-hover/volume:opacity-100"
+ style={{ ["--range-ratio" as string]: level }}
/>
<button
type="button"
diff --git a/studio/frontend/src/features/chat/chat-settings-sheet.tsx b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
index 8b46dd35683..b94ad5b1aae 100644
--- a/studio/frontend/src/features/chat/chat-settings-sheet.tsx
+++ b/studio/frontend/src/features/chat/chat-settings-sheet.tsx
@@ -216,7 +216,7 @@ export function ParamSlider({
max={max}
step={step}
{...sliderProps}
- className="panel-slider min-w-0 flex-1"
+ className="min-w-0 flex-1"
disabled={disabled}
/>
<NumericValueInput
@@ -261,7 +261,6 @@ export function ParamSlider({
max={max}
step={step}
{...sliderProps}
- className="panel-slider"
disabled={disabled}
/>
</div>
diff --git a/studio/frontend/src/features/hub/catalog/model-search-filters.tsx b/studio/frontend/src/features/hub/catalog/model-search-filters.tsx
index bad1c304c96..6fcdbc6a4f7 100644
--- a/studio/frontend/src/features/hub/catalog/model-search-filters.tsx
+++ b/studio/frontend/src/features/hub/catalog/model-search-filters.tsx
@@ -195,7 +195,7 @@ const MODALITY_ICONS: Record<DatasetModality, IconSvgElement> = {
video: FlimSlateIcon,
};
-const THUMB = 12;
+const THUMB = "var(--hub-range-thumb)";
const SLIDER_FG =
"[--hub-slider-fg:color-mix(in_oklab,var(--foreground)_68%,var(--background))] dark:[--hub-slider-fg:color-mix(in_oklab,var(--foreground)_86%,var(--background))]";
const RANGE_FILL = "bg-(--hub-slider-fg)";
@@ -248,7 +248,7 @@ function RangeStops({
const edge = (i: number) =>
i === 0 ? { left: 0 } : i === last ? { right: 0 } : undefined;
const at = (i: number) =>
- `calc(${THUMB / 2}px + (100% - ${THUMB}px) * ${i / last})`;
+ `calc(${THUMB} / 2 + (100% - ${THUMB}) * ${i / last})`;
const chip = (i: number) => spec.labels[i] ?? spec.format(spec.stops[i]);
return (
<fieldset>
@@ -276,11 +276,7 @@ function RangeStops({
)}
</legend>
{/* Inset by an end pill's overhang, so the pills line up with the labels above. */}
- {/* Ends at the thumb's edge, which doesn't scale with the h-4 root, so the gap below matches. */}
- <div
- style={{ marginBottom: `calc((${THUMB}px - var(--spacing) * 4) / 2)` }}
- className={cn("relative mx-4.5 pt-7", SLIDER_FG)}
- >
+ <div className={cn("hub-range relative mx-4.5 pt-7", SLIDER_FG)}>
<div aria-hidden={true} className="absolute inset-x-0 top-0 h-5">
{spec.labels.map((label, i) =>
label === null && !covered(i) ? null : (
@@ -320,9 +316,9 @@ function RangeStops({
[spec.max]: next[1] === last ? undefined : spec.stops[next[1]],
});
}}
- className="group/range relative flex h-4 w-full touch-none select-none items-center"
+ className="group/range relative flex h-(--hub-range-thumb) w-full touch-none select-none items-center"
>
- <SliderPrimitive.Track className="relative h-[3px] w-full grow rounded-full bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)]">
+ <SliderPrimitive.Track className="relative h-(--hub-range-track) w-full grow rounded-full bg-[color-mix(in_oklab,var(--foreground)_calc(4%*var(--contrast-wash-gain,1)),transparent)]">
{spec.stops.map((_, i) =>
// Under the range, which covers them where it runs, so its fill stays unbroken.
i === 0 || i === last ? null : (
@@ -344,9 +340,8 @@ function RangeStops({
key={thumb === 0 ? "min" : "max"}
aria-label={`${thumb === 0 ? "Minimum" : "Maximum"} ${spec.label.toLowerCase()}`}
aria-valuetext={chip(index)}
- style={{ width: THUMB, height: THUMB }}
className={cn(
- "relative block cursor-grab rounded-full outline-none transition-shadow duration-150 hover:shadow-[0_0_0_8px_color-mix(in_srgb,var(--hub-slider-fg)_18%,transparent)] focus-visible:shadow-[0_0_0_8px_color-mix(in_srgb,var(--hub-slider-fg)_18%,transparent)] active:cursor-grabbing active:shadow-[0_0_0_10px_color-mix(in_srgb,var(--hub-slider-fg)_22%,transparent)]",
+ "relative block size-(--hub-range-thumb) cursor-grab rounded-full ring-(--hub-slider-fg)/20 outline-none focus-visible:ring-4 active:cursor-grabbing",
RANGE_FILL,
)}
/>
diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.css
index 7867a8d5854..374efa0c8df 100644
--- a/studio/frontend/src/features/hub/hub.css
+++ b/studio/frontend/src/features/hub/hub.css
@@ -1666,3 +1666,15 @@ html.dark .hub-page [data-hub-scroll="true"]::-webkit-scrollbar-thumb {
body[data-scroll-locked] .hub-modal-pe-guard {
pointer-events: none !important;
}
+
+/* Model filter ranges: two thumbs share a track, so smaller than a single slider. */
+.hub-range {
+ --hub-range-thumb: calc(1rem * var(--ui-space-scale, 1));
+ --hub-range-track: calc(0.1875rem * var(--ui-space-scale, 1));
+}
+@supports (width: round(1.5px, 1px)) {
+ .hub-range {
+ --hub-range-thumb: round(calc(1rem * var(--ui-space-scale, 1)), 1px);
+ --hub-range-track: round(calc(0.1875rem * var(--ui-space-scale, 1)), var(--device-px, 1px));
+ }
+}
diff --git a/studio/frontend/src/features/model-picker/components/model-config-page.tsx b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
index a43739d93c5..fd3ed959043 100644
--- a/studio/frontend/src/features/model-picker/components/model-config-page.tsx
+++ b/studio/frontend/src/features/model-picker/components/model-config-page.tsx
@@ -545,7 +545,6 @@ function MaxSeqLengthSetting({
max={max}
step={MAX_SEQ_LENGTH_STEP}
{...sliderProps}
- className="panel-slider"
aria-label={label}
/>
</div>
@@ -616,7 +615,6 @@ function GgufContextLengthSetting({
max={max}
step={128}
{...sliderProps}
- className="panel-slider"
aria-label="Context Length"
thumbValueText={(v) =>
v !== 0
@@ -697,7 +695,6 @@ function AdvancedGpuSlider({
max={max}
step={step}
{...sliderProps}
- className="panel-slider"
aria-label={label}
disabled={disabled}
/>
diff --git a/studio/frontend/src/features/rag/components/retrieval-settings-section.tsx b/studio/frontend/src/features/rag/components/retrieval-settings-section.tsx
index 3c31fbf672a..2dbea90bb19 100644
--- a/studio/frontend/src/features/rag/components/retrieval-settings-section.tsx
+++ b/studio/frontend/src/features/rag/components/retrieval-settings-section.tsx
@@ -68,7 +68,6 @@ function SliderRow({
disabled={disabled}
onValueChange={([v]) => onChange(v)}
aria-label={label}
- className="panel-slider"
/>
</div>
);
@@ -137,7 +136,6 @@ export function RetrievalSettingsSection() {
step={1}
onValueChange={([value]) => setRagTopK(value)}
aria-label="Number of passages to retrieve"
- className="panel-slider"
/>
</div>
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 24bfda95af7..31afa3a6ea0 100644
--- a/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
+++ b/studio/frontend/src/features/settings/components/appearance-custom-controls.tsx
@@ -958,12 +958,12 @@ export function ContrastSliderRow() {
return (
<div className="flex w-64 items-center gap-3">
<Slider
+ className="contrast-slider"
value={[contrast]}
min={0}
max={100}
step={1}
onValueChange={(values: number[]) => patch({ contrast: values[0] })}
- className="panel-slider"
aria-label={t("settings.appearance.custom.contrast.label")}
/>
<NumericValueInput
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index 88fe7920c11..9d83de3adee 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -352,12 +352,17 @@
so the tone has a faint hue rather than pure neutral — keeps text and
sliders quiet but not lifeless. */
--panel-surface-fg-muted: #777779;
- /* Slider track-fill / thumb / hover halo. Decoupled from
- --panel-surface-fg-muted so the slider can be tuned independently
- from muted text. Light mode: lighter than the muted-text gray for
+ /* Panel switch track. Light mode: lighter than the muted-text gray for
a softer feel. Dark mode (further down) keeps parity with the
muted-text token. */
--panel-slider-fg-base: #9a9a9c;
+ /* Every slider except the Hub range filter (hub.css). */
+ --slider-fill: var(--control-accent);
+ --slider-track: rgb(0 0 0 / calc(0.065 * var(--contrast-wash-gain, 1)));
+ --slider-thumb: #ffffff;
+ --slider-thumb-shadow: inset 0 0 0 1px #dbdbdb, 0 1.5px 2.5px -0.5px rgb(0 0 0 / 0.08);
+ --slider-track-height: calc(0.15625rem * var(--ui-space-scale, 1));
+ --slider-thumb-size: calc(1.25rem * var(--ui-space-scale, 1));
/* Chat-message action icons (assistant action bar, branch picker
chevrons + numbers, message-timing token counter, code-block
copy/download, user action bar, delete button). One token drives
@@ -560,6 +565,9 @@
--panel-surface-fg-muted: #b0b0b0;
/* Dark-mode slider tone matches muted text. */
--panel-slider-fg-base: #b0b0b0;
+ --slider-fill: color-mix(in oklab, var(--control-accent) 75%, #a0a0a0);
+ --slider-track: rgb(255 255 255 / calc(0.09 * var(--contrast-wash-gain, 1)));
+ --slider-thumb-shadow: 0 1px 2px -0.5px rgb(0 0 0 / 0.12);
/* Chat action icons: under the ink so they read as controls, not text.
Hover restores full --foreground. */
--chat-icon-fg-base: #c4c4c4;
@@ -2582,78 +2590,6 @@ html[data-chat-font] .aui-root {
background-color: var(--panel-input-surface-hover);
}
- /* Sidebar sliders: soft neutral grays — active fill and thumb stay
- in the same neutral family as the panel surface so the controls
- read as quiet, modern, and uncluttered. Flat (no shadow), small
- thumb, no ring. The track's translucent neutral adapts to either
- theme; the fill/thumb pick a mid-gray with enough contrast to
- read on the panel without competing with text. */
- /* Inactive track: barely-there alpha so it reads as a faint hint
- rather than a visible bar — the active fill carries the value,
- the track just suggests the slider's extent. Same alpha both
- themes; the black/white base flips automatically per theme. */
- .panel-slider [data-slot="slider-track"] {
- height: 0.25rem !important;
- background-color: rgb(0 0 0 / calc(0.025 * var(--contrast-wash-gain, 1))) !important;
- }
- .dark .panel-slider [data-slot="slider-track"] {
- background-color: rgb(255 255 255 / calc(0.025 * var(--contrast-wash-gain, 1))) !important;
- }
- /* Sliders in the right-side parameters panel.
- *
- * Color: every interactive surface (active fill, thumb body, thumb
- * border, hover/press halo) resolves through a single token —
- * `--panel-surface-fg-muted` — so the slider always belongs to the
- * same gray family as the panel's muted text. Theme switching and
- * future tone tweaks happen in one place.
- *
- * Pressure feedback: only the halo expresses interaction. The
- * shared <Slider /> component (components/ui/slider.tsx) applies
- * `hover:scale-110`, `active:scale-95`, `hover:ring-4`, and
- * `shadow-sm` to the thumb via Tailwind utilities. Suppressing
- * `transform` and `box-shadow` on the base rule prevents those from
- * competing with the halo's transition — without that, two
- * animations run on different durations/curves and the interaction
- * reads as jittery.
- *
- * Track-press detection: Radix's slider thumb only exposes
- * `data-disabled` and `data-orientation` (verified against the
- * package source) — there is no active-state attribute on the
- * thumb. We anchor the press selector on the slider root
- * (`.panel-slider:active`), which receives `:active` for any
- * pointer-down inside the slider, including presses that start on
- * the track. This is the only DOM-faithful way to show the halo
- * during a track-press without patching the shared component.
- *
- * Halo lifecycle: deliberately no `:focus` — pointer focus persists
- * after release and would leave a stale halo. `:focus-visible`
- * keeps keyboard navigation accessible (Tab + arrows). */
- .panel-slider .bg-primary {
- background-color: var(--panel-slider-fg) !important;
- }
- .panel-slider [data-slot="slider-thumb"] {
- width: calc(0.875rem * var(--ui-space-scale, 1)) !important;
- height: calc(0.875rem * var(--ui-space-scale, 1)) !important;
- background-color: var(--panel-slider-fg) !important;
- border-color: var(--panel-slider-fg) !important;
- transform: none !important;
- box-shadow: none !important;
- transition: box-shadow 140ms ease-out !important;
- }
- .panel-slider [data-slot="slider-thumb"]:hover,
- .panel-slider [data-slot="slider-thumb"]:focus-visible,
- .panel-slider:active [data-slot="slider-thumb"] {
- box-shadow: 0 0 0 10px
- color-mix(in srgb, var(--panel-slider-fg) 18%, transparent) !important;
- }
- /* Active press: slightly larger / more opaque ring than passive
- hover, so the haptic reads stronger when the user is actively
- manipulating the value. */
- .panel-slider:active [data-slot="slider-thumb"] {
- box-shadow: 0 0 0 12px
- color-mix(in srgb, var(--panel-slider-fg) 22%, transparent) !important;
- }
-
/* Images (Create + Train) and Video: a lighter control border than the palette
default. Light mode only, since dark mode draws these controls borderless.
Overrides the token, so every derived shade stays in step. */
@@ -5296,58 +5232,104 @@ html.force-reduced-motion .sidebar-section-drop-line {
color-mix(in oklab, var(--primary) 9%, var(--background));
}
-/* Thin track filled up to --range-fill, with a round thumb. */
-.browser-video-range {
+/* Whole screen pixels at any zoom (--device-px, set in public/theme-boot.js): a
+ fractional track is snapped to a different height per row, so sliders on one
+ panel look unequally thick. */
+@supports (width: round(1.5px, 1px)) {
+ :root {
+ --slider-track-height: round(calc(0.15625rem * var(--ui-space-scale, 1)), var(--device-px, 1px));
+ --slider-thumb-size: round(calc(1.25rem * var(--ui-space-scale, 1)), 1px);
+ }
+}
+
+/* Settings > Appearance contrast: one ramp along the track instead of a fill. */
+.contrast-slider [data-slot="slider-track"] {
+ background: linear-gradient(
+ to right,
+ color-mix(in srgb, var(--slider-fill) 35%, transparent),
+ var(--slider-fill) 40%
+ );
+}
+.contrast-slider [data-slot="slider-track"] > * {
+ background: none;
+}
+
+/* Native <input type="range"> in the shared slider look (components/ui/slider.tsx).
+ --range-ratio (0..1) places the fill's end under the thumb's centre, which sits
+ half a thumb in from each end. */
+.native-range {
+ --range-fill-end: calc(
+ var(--slider-thumb-size) / 2 + (100% - var(--slider-thumb-size)) * var(--range-ratio, 0)
+ );
appearance: none;
- height: 1.25rem;
+ height: var(--slider-thumb-size);
background: transparent;
cursor: pointer;
}
-.browser-video-range:disabled {
+.native-range:disabled {
cursor: default;
+ opacity: 0.5;
}
-.browser-video-range::-webkit-slider-runnable-track {
- height: 4px;
+.native-range::-webkit-slider-runnable-track {
+ height: var(--slider-track-height);
border-radius: 9999px;
background: linear-gradient(
to right,
- var(--foreground) var(--range-fill, 0%),
- color-mix(in oklab, var(--foreground) 16%, transparent) var(--range-fill, 0%)
+ var(--slider-fill) var(--range-fill-end),
+ var(--slider-track) var(--range-fill-end)
);
}
-.browser-video-range::-moz-range-track {
- height: 4px;
+.native-range::-moz-range-track {
+ height: var(--slider-track-height);
border-radius: 9999px;
- background: color-mix(in oklab, var(--foreground) 16%, transparent);
+ background: var(--slider-track);
}
-.browser-video-range::-moz-range-progress {
- height: 4px;
+.native-range::-moz-range-progress {
+ height: var(--slider-track-height);
border-radius: 9999px;
- background: var(--foreground);
+ background: var(--slider-fill);
}
-.browser-video-range::-webkit-slider-thumb {
+.native-range::-webkit-slider-thumb {
appearance: none;
- width: 14px;
- height: 14px;
- margin-top: -5px;
+ box-sizing: border-box;
+ width: var(--slider-thumb-size);
+ height: var(--slider-thumb-size);
+ margin-top: calc((var(--slider-track-height) - var(--slider-thumb-size)) / 2);
border-radius: 9999px;
- background: var(--background);
- border: 1px solid color-mix(in oklab, var(--foreground) 22%, transparent);
- box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
+ background: var(--slider-thumb);
+ border: none;
+ box-shadow: var(--slider-thumb-shadow);
}
-.browser-video-range::-moz-range-thumb {
- width: 14px;
- height: 14px;
+.native-range::-moz-range-thumb {
+ box-sizing: border-box;
+ width: var(--slider-thumb-size);
+ height: var(--slider-thumb-size);
border-radius: 9999px;
- background: var(--background);
- border: 1px solid color-mix(in oklab, var(--foreground) 22%, transparent);
- box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
+ background: var(--slider-thumb);
+ border: none;
+ box-shadow: var(--slider-thumb-shadow);
+}
+
+.native-range:focus-visible {
+ outline: none;
+}
+
+.native-range:focus-visible::-webkit-slider-thumb {
+ box-shadow:
+ var(--slider-thumb-shadow),
+ 0 0 0 4px color-mix(in srgb, var(--slider-fill) 30%, transparent);
+}
+
+.native-range:focus-visible::-moz-range-thumb {
+ box-shadow:
+ var(--slider-thumb-shadow),
+ 0 0 0 4px color-mix(in srgb, var(--slider-fill) 30%, transparent);
}
/* Scales the container query's em with the UI size; children reset to the inherited 1rem. */
diff --git a/studio/frontend/tests/contrast-slider.test.ts b/studio/frontend/tests/contrast-slider.test.ts
index 7ad5760d104..effd226b73c 100644
--- a/studio/frontend/tests/contrast-slider.test.ts
+++ b/studio/frontend/tests/contrast-slider.test.ts
@@ -379,16 +379,15 @@ test("a dark selection fill takes the token, not a wash", () => {
);
});
-test("panel sliders move with the slider too", () => {
- // .panel-slider repaints the track, fill and thumb with !important, so the
- // component's own gain-aware colours never reach them.
+test("slider tracks move with the slider too", () => {
+ // Every slider paints its track from --slider-track, in both themes.
assert.match(
CSS,
- /\.panel-slider \[data-slot="slider-track"\] \{[^}]*rgb\(0 0 0 \/ calc\(0\.025 \* var\(--contrast-wash-gain, 1\)\)\)/,
+ /--slider-track: rgb\(0 0 0 \/ calc\(0\.065 \* var\(--contrast-wash-gain, 1\)\)\);/,
);
assert.match(
CSS,
- /\.dark \.panel-slider \[data-slot="slider-track"\] \{[^}]*rgb\(255 255 255 \/ calc\(0\.025 \* var\(--contrast-wash-gain, 1\)\)\)/,
+ /--slider-track: rgb\(255 255 255 \/ calc\(0\.09 \* var\(--contrast-wash-gain, 1\)\)\);/,
);
assert.ok(CSS.includes("--panel-slider-fg: var(--panel-slider-fg-base);"));
assert.match(
diff --git a/studio/frontend/tests/ui-font-size-scales-spacing.test.ts b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
index d276ac8128d..b99e740d2e0 100644
--- a/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
+++ b/studio/frontend/tests/ui-font-size-scales-spacing.test.ts
@@ -308,10 +308,8 @@ test("the plain stylesheets' controls follow the scale", () => {
`${rule} has a fixed size`,
);
}
- assert.match(
- CSS,
- /\.panel-slider \[data-slot="slider-thumb"\] \{\s*width: calc\(0\.875rem \* var\(--ui-space-scale, 1\)\) !important;/,
- );
+ assert.match(CSS, /--slider-thumb-size: calc\(1\.25rem \* var\(--ui-space-scale, 1\)\);/);
+ assert.match(CSS, /--slider-track-height: calc\(0\.15625rem \* var\(--ui-space-scale, 1\)\);/);
});
test("a scaled minimum never outgrows its own cap", () => {