Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

High Windows versions should render the downloader in dark mode (black background/white text, matching progress bar) when the OS is in dark theme.

  • Dark-mode detection

    • Read AppsUseLightTheme from HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize; treat value 0 as dark mode.
    • Gracefully fall back to light mode on missing key or access issues (debug-logged in DEBUG builds).
  • Theming application

    • Centralized dark brushes; apply to window background/foreground and progress bar background when dark mode is detected.

Example:

private const int DarkModeRegistryValue = 0; // dark mode
if (appsUseLightTheme is int value && value == DarkModeRegistryValue)
{
    Background = DarkBackgroundBrush;
    Foreground = DarkForegroundBrush;
    DownloadProgressBar.Background = DarkBackgroundBrush;
}
Original prompt

尝试适配Windows高版本的深色模式,如果是深色模式则黑底白字,进度条也换成黑底


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 8 commits December 12, 2025 17:07
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
@mrbbbaixue mrbbbaixue marked this pull request as ready for review December 12, 2025 17:12
Copilot AI review requested due to automatic review settings December 12, 2025 17:12
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Copilot AI and others added 3 commits December 12, 2025 17:13
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Copy link

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 Windows high-version dark mode support to the WPF downloader application. When Windows is in dark mode, the application now detects this via registry settings and applies dark theme colors (black background, white text, and dark progress bar).

  • Implements registry-based Windows dark mode detection
  • Applies dark theme styling to window and progress bar controls
  • Adds comprehensive exception handling for registry access failures

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

Comment on lines 16 to 17
private const int DarkModeRegistryValue = 0; // 0 means AppsUseLightTheme is false (dark mode enabled)
private static readonly Brush DarkBackgroundBrush = Brushes.Black;
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

The static brush fields defined here are never used in the code. The ApplySystemTheme method directly uses Brushes.Black and Brushes.White instead of these DarkBackgroundBrush and DarkForegroundBrush fields. Either use these fields in ApplySystemTheme or remove them to avoid unnecessary code.

Copilot uses AI. Check for mistakes.
{
return;
}

Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

Setting only the Background property of the ProgressBar to black will not provide proper dark mode styling. In dark mode, the ProgressBar's foreground (the filled portion) should remain visible against the black background. Consider setting the Foreground property of DownloadProgressBar to a light color or adjusting other styling properties to ensure the progress indicator remains visible in dark mode.

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +56
return;
}

Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

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

Setting only the window's Background and Foreground properties won't automatically apply dark mode styling to all child controls. The Hyperlink, TextBlocks, and RadioButtons will retain their default styling and may not be readable in dark mode. Consider applying dark theme colors to these controls as well, or use a comprehensive WPF theming solution.

Copilot uses AI. Check for mistakes.
Co-authored-by: mrbbbaixue <17956756+mrbbbaixue@users.noreply.github.com>
Copilot AI changed the title [WIP] Add Windows high version dark mode support Add Windows dark-mode theming to downloader UI Dec 12, 2025
Copilot AI requested a review from mrbbbaixue December 12, 2025 17:17
@mrbbbaixue mrbbbaixue merged commit 8b5c82b into main Dec 12, 2025
1 check passed
@mrbbbaixue mrbbbaixue deleted the copilot/adapt-dark-mode-for-windows branch December 12, 2025 17:49
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.

2 participants