diff --git a/luci-app-secubox/htdocs/luci-static/resources/secubox/theme.js b/luci-app-secubox/htdocs/luci-static/resources/secubox/theme.js index 36f8cf77..a91aa785 100644 --- a/luci-app-secubox/htdocs/luci-static/resources/secubox/theme.js +++ b/luci-app-secubox/htdocs/luci-static/resources/secubox/theme.js @@ -59,5 +59,18 @@ return baseclass.extend({ */ getCurrentTheme: function() { return document.documentElement.getAttribute('data-theme') || 'dark'; + }, + + /** + * Get theme preference from backend + * @returns {Promise} Theme preference ('dark', 'light', or 'system') + */ + getTheme: function() { + return API.getTheme().then(function(data) { + return data.theme || 'dark'; + }).catch(function(err) { + console.error('Failed to load theme preference:', err); + return 'dark'; + }); } });