Skip to content

Conversation

@RKBoss6
Copy link
Contributor

@RKBoss6 RKBoss6 commented Dec 22, 2025

In conjunction with #4103, this helps add dark mode to the app loader. Adding dark mode helps significantly with eye strain, and blending into the device's UI. Check it out on my personal app loader! and let me know of any suggestions/comments.

Specifically, this PR handles ensuring the right theme is displayed, and theming of app html customizer iframes.

Screenshots:

Screenshot 2025-12-22 at 1 54 05 PM
Screenshot 2025-12-22 at 1 54 14 PM Screenshot 2025-12-22 at 1 54 22 PM

Added theme setting functionality and applied theme changes based on user preference and system settings.
Copilot AI review requested due to automatic review settings December 22, 2025 19:13
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds dark mode support to the app loader with three theme options: light, dark, and device (follows system preference). The implementation handles theme persistence in settings, dynamic theme application, and extends dark mode styling to app customizer iframes.

Key Changes:

  • Added theme setting with three modes: light, dark, and device
  • Implemented theme application logic that respects user preferences and system settings
  • Applied dark mode styling to app customizer iframes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

js/index.js Outdated
Comment on lines 1450 to 1456
function repaintSite(){
//tricks browser into repainting the site to apply theme changes
const body = document.body;
body.style.display = 'none';
body.offsetHeight;
body.style.display = '';
}
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repaintSite function is defined but never called anywhere in the code. This function should either be removed or integrated into the theme application logic if it's needed.

Suggested change
function repaintSite(){
//tricks browser into repainting the site to apply theme changes
const body = document.body;
body.style.display = 'none';
body.offsetHeight;
body.style.display = '';
}

Copilot uses AI. Check for mistakes.
js/index.js Outdated
Comment on lines 29 to 31



Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These blank lines appear to be unnecessary and should be removed to maintain code consistency.

Suggested change

Copilot uses AI. Check for mistakes.
js/index.js Outdated
Comment on lines 320 to 324
// Style custom apps for dark mode
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDoc && iframeDoc.body) {
const bgColor = window.matchMedia('(prefers-color-scheme: dark)').matches ? '#2c2c2c' : '#ffffff';
const textColor = window.matchMedia('(prefers-color-scheme: dark)').matches ? '#FFFFFF' : '#000000';
Copy link

Copilot AI Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The iframe styling always checks the system's color scheme preference using matchMedia, but it should respect the user's theme setting (SETTINGS.theme) instead. When the user selects "light" or "dark" explicitly, the iframe should use that theme rather than always following the system preference. Consider using the applyTheme logic or a similar approach to determine which theme to apply based on SETTINGS.theme.

Suggested change
// Style custom apps for dark mode
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDoc && iframeDoc.body) {
const bgColor = window.matchMedia('(prefers-color-scheme: dark)').matches ? '#2c2c2c' : '#ffffff';
const textColor = window.matchMedia('(prefers-color-scheme: dark)').matches ? '#FFFFFF' : '#000000';
// Style custom apps according to theme (light/dark/device)
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
if (iframeDoc && iframeDoc.body) {
// Determine effective theme: use SETTINGS.theme if available, otherwise default
const currentSettings = (typeof SETTINGS !== "undefined" && SETTINGS) ? SETTINGS : DEFAULTSETTINGS;
const theme = currentSettings && currentSettings.theme ? currentSettings.theme : DEFAULTSETTINGS.theme;
const prefersDark = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches;
const isDark = theme === "dark" || (theme === "device" && prefersDark);
const bgColor = isDark ? "#2c2c2c" : "#ffffff";
const textColor = isDark ? "#FFFFFF" : "#000000";

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant