diff --git a/apps/common/main/lib/util/htmlutils.js b/apps/common/main/lib/util/htmlutils.js
index 16a5b18a5a..8db37206ff 100644
--- a/apps/common/main/lib/util/htmlutils.js
+++ b/apps/common/main/lib/util/htmlutils.js
@@ -91,7 +91,7 @@ if ( !!params.uitheme && checkLocalStorage && !localStorage.getItem("ui-theme-id
var ui_theme_name = checkLocalStorage && localStorage.getItem("ui-theme-id") ? localStorage.getItem("ui-theme-id") : params.uitheme;
var ui_theme_type;
if ( !ui_theme_name ) {
- if ( (desktop && desktop.theme && desktop.theme.system == 'dark') ||
+ if ( (window.desktop && desktop.theme && desktop.theme.system == 'dark') ||
(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) )
{
ui_theme_name = 'theme-dark';