Skip to content

Commit 67ef389

Browse files
committed
Fix illegible slider: precise BaseWeb track/fill/thumb/tick selectors
The previous rule .stSlider [data-baseweb="slider"] > div { background: accent !important; } matched *every* direct child of the slider container, so the tick-bar, empty-track, thumb halo and filled-track were all painted solid teal. Numbers and the draggable thumb became invisible against the bar. Replace it with targeted selectors (light and dark): - empty track -> faint accent tint - filled track -> solid accent (light) / teal-purple gradient (dark) - thumb -> white puck with accent ring, readable on both themes - value bubble -> transparent background, accent-coloured text - tick labels -> muted foreground, transparent background Made-with: Cursor
1 parent af4a4de commit 67ef389

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

app/_common.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,34 @@ def apply_theme() -> None:
222222
box-shadow: 0 3px 10px rgba(15,118,110,0.18);
223223
}}
224224
.stButton > button:active {{ transform: translateY(0); }}
225-
.stSlider [data-baseweb="slider"] > div {{ background: var(--qqa-accent) !important; }}
225+
/* ---- BaseWeb slider (light) ----------------------------------- */
226+
/* Empty track: subtle accent tint so the filled part stands out */
227+
.stSlider [data-baseweb="slider"] [role="slider"] ~ div,
228+
.stSlider [data-baseweb="slider"] > div > div > div:first-child {{
229+
background: rgba(15,118,110,0.18) !important;
230+
}}
231+
/* Filled portion of the track (left of thumb) */
232+
.stSlider [data-baseweb="slider"] > div > div > div:first-child > div {{
233+
background: var(--qqa-accent) !important;
234+
}}
235+
/* Thumb: white puck with accent ring so it's always visible */
236+
.stSlider [data-baseweb="slider"] [role="slider"] {{
237+
background: #ffffff !important;
238+
border: 2px solid var(--qqa-accent) !important;
239+
box-shadow: 0 1px 3px rgba(15,23,42,0.18) !important;
240+
}}
241+
/* Current-value bubble above the thumb */
242+
.stSlider [data-baseweb="slider"] [role="slider"] > div {{
243+
color: var(--qqa-accent) !important;
244+
background: transparent !important;
245+
font-weight: 600 !important;
246+
}}
247+
/* Min / max tick labels at the ends of the slider */
248+
.stSlider [data-testid="stTickBar"],
249+
.stSlider [data-testid="stTickBar"] > div {{
250+
color: var(--qqa-muted) !important;
251+
background: transparent !important;
252+
}}
226253
code, pre {{
227254
background: #f0ece3;
228255
color: #334155;
@@ -349,6 +376,28 @@ def apply_theme() -> None:
349376
transform: translateY(-1px);
350377
box-shadow: 0 10px 28px rgba(168,85,247,0.35);
351378
}}
379+
/* ---- BaseWeb slider (dark) ------------------------------------ */
380+
.stSlider [data-baseweb="slider"] [role="slider"] ~ div,
381+
.stSlider [data-baseweb="slider"] > div > div > div:first-child {{
382+
background: rgba(148,163,184,0.25) !important;
383+
}}
384+
.stSlider [data-baseweb="slider"] > div > div > div:first-child > div {{
385+
background: linear-gradient(90deg, #38bdf8, #a855f7) !important;
386+
}}
387+
.stSlider [data-baseweb="slider"] [role="slider"] {{
388+
background: #0b1120 !important;
389+
border: 2px solid #38bdf8 !important;
390+
box-shadow: 0 0 0 2px rgba(56,189,248,0.25) !important;
391+
}}
392+
.stSlider [data-baseweb="slider"] [role="slider"] > div {{
393+
color: #e2e8f0 !important;
394+
background: transparent !important;
395+
}}
396+
.stSlider [data-testid="stTickBar"],
397+
.stSlider [data-testid="stTickBar"] > div {{
398+
color: var(--qqa-muted) !important;
399+
background: transparent !important;
400+
}}
352401
code, pre {{
353402
background: rgba(15,23,42,0.75);
354403
color: #bae6fd;

0 commit comments

Comments
 (0)