export function darkModeToggle() {
    var turnOnDark = !document?.documentElement.classList.contains('dark');
    doFade(turnOnDark, document?.documentElement, fadeOut);
    setTimeout(() => {
        doFade(turnOnDark, document?.documentElement, fadeIn);
    }, 400);
}
if (typeof document !== 'undefined')
    doFade(false, document?.documentElement, fadeIn);
function doFade(turnOnDark, node, action) {
    action(turnOnDark, node);
}
function fadeIn(turnOnDark, element) {
    if (typeof element === 'undefined')
        return;
    if (turnOnDark) {
        element.classList.add('dark');
    }
    else {
        element.classList.remove('dark');
    }
    element.classList.remove('fade-out');
    element.classList.add('fade-in');
}
function fadeOut(turnOnDark, element) {
    if (typeof element === 'undefined')
        return;
    element.classList.remove('fade-in');
    element.classList.add('fade-out');
}
