mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-06 02:47:54 +00:00
Co-authored-by: Dhravya Shah <dhravya@supermemory.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
21 lines
789 B
JavaScript
21 lines
789 B
JavaScript
// Theme switches should snap, not smear. Every control eases its colours on hover, so
|
|
// when light/dark flips, all of those transitions would fire at once. For the frame the
|
|
// theme class changes, turn transitions off, force a reflow, then restore them.
|
|
;(() => {
|
|
var root = document.documentElement
|
|
var wasDark = root.classList.contains("dark")
|
|
|
|
new MutationObserver(() => {
|
|
var isDark = root.classList.contains("dark")
|
|
if (isDark === wasDark) return
|
|
wasDark = isDark
|
|
|
|
var style = document.createElement("style")
|
|
style.textContent = "*,*::before,*::after{transition:none !important}"
|
|
document.head.appendChild(style)
|
|
void root.offsetHeight
|
|
requestAnimationFrame(() => {
|
|
style.remove()
|
|
})
|
|
}).observe(root, { attributes: true, attributeFilter: ["class"] })
|
|
})()
|