diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js index 37bff2dbf7..7d5b0161b0 100644 --- a/apps/common/main/lib/util/htmlutils.js +++ b/apps/common/main/lib/util/htmlutils.js @@ -45,6 +45,12 @@ if ( !!params.uitheme && !localStorage.getItem("ui-theme") ) { } var ui_theme_name = localStorage.getItem("ui-theme"); +if ( !ui_theme_name ) { + if ( window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ) { + ui_theme_name = 'theme-dark'; + localStorage.setItem("ui-theme", ui_theme_name); + } +} if ( !!ui_theme_name ) { document.body.classList.add(ui_theme_name); }