demarches-normaliennes/app/views/layouts/_setup_theme.html.haml

9 lines
351 B
Text
Raw Normal View History

:javascript
function setDarkBeforeRender() {
const localScheme = localStorage.getItem('scheme')
if (localScheme == 'dark' || (localScheme == 'system' && window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.setAttribute('data-fr-theme', 'dark');
}
}
setDarkBeforeRender();