Add smooth CSS transition for theme changes

- Apply 300ms transition to background and text colors during theme switch
- Prevents jarring flash when signer prompt appears
- Transition removed after completion to avoid affecting other animations

Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
This commit is contained in:
shakespeare.diy
2026-02-18 03:36:35 -06:00
parent e4cb3fd10e
commit faef42481d
+10
View File
@@ -94,8 +94,18 @@ export function AppProvider(props: AppProviderProps) {
function useApplyTheme(theme: Theme) {
useEffect(() => {
const root = window.document.documentElement;
// Add transition class before changing theme
root.style.setProperty('transition', 'background-color 0.3s ease, color 0.3s ease');
root.classList.remove('dark', 'light', 'black', 'pink');
root.classList.add(theme);
// Remove transition after it completes to avoid affecting other animations
const timer = setTimeout(() => {
root.style.removeProperty('transition');
}, 300);
return () => clearTimeout(timer);
}, [theme]);
}