Fix: Animated scrollbar renders black in NO_COLOR mode (#13188)

This commit is contained in:
Jacob Richman
2025-11-16 20:45:07 -08:00
committed by GitHub
parent a74d1943e3
commit 4b2ad38c13
9 changed files with 202 additions and 44 deletions
@@ -49,11 +49,15 @@ export function useAnimatedScrollbar(
const unfocusedColor = theme.ui.dark;
const startColor = colorRef.current;
if (!focusedColor || !unfocusedColor) {
return;
}
// Phase 1: Fade In
let start = Date.now();
const animateFadeIn = () => {
const elapsed = Date.now() - start;
const progress = Math.min(elapsed / fadeInDuration, 1);
const progress = Math.max(0, Math.min(elapsed / fadeInDuration, 1));
setScrollbarColor(interpolateColor(startColor, focusedColor, progress));
@@ -69,7 +73,10 @@ export function useAnimatedScrollbar(
start = Date.now();
const animateFadeOut = () => {
const elapsed = Date.now() - start;
const progress = Math.min(elapsed / fadeOutDuration, 1);
const progress = Math.max(
0,
Math.min(elapsed / fadeOutDuration, 1),
);
setScrollbarColor(
interpolateColor(focusedColor, unfocusedColor, progress),
);