Skip to content

优化深色模式支持#5283

Merged
Glavo merged 4 commits into
HMCL-dev:mainfrom
Glavo:dark-mode
Jan 23, 2026
Merged

优化深色模式支持#5283
Glavo merged 4 commits into
HMCL-dev:mainfrom
Glavo:dark-mode

Conversation

@Glavo
Copy link
Copy Markdown
Member

@Glavo Glavo commented Jan 23, 2026

  1. 修复 macOS 上主题模式设置无法跟随系统设置的问题
  2. 在低版本 JavaFX 上支持跟随系统设置(目前仅支持 Windows/macOS,且仅在启动时检测一次,不会在运行中持续检测主题模式变化)

Copy link
Copy Markdown
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 optimizes dark mode support by fixing theme mode settings on macOS to follow system settings and adding fallback support for system theme detection on lower JavaFX versions (currently Windows/macOS only, detected once at startup).

Changes:

  • Always show "auto", "light", and "dark" theme options in the UI regardless of JavaFX version
  • Add fallback system theme detection for older JavaFX versions using native APIs (Windows registry and macOS defaults command)
  • Set apple.awt.application.appearance to "system" on macOS to enable system theme following

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
HMCL/src/main/java/org/jackhuang/hmcl/ui/main/PersonalizationPage.java Removed conditional logic that hid the "auto" theme option on older JavaFX versions, now always shows all three options
HMCL/src/main/java/org/jackhuang/hmcl/theme/Themes.java Added getDefaultBrightness() method to detect system theme via Windows registry or macOS defaults command when JavaFX native support is unavailable
HMCL/src/main/java/org/jackhuang/hmcl/EntryPoint.java Set apple.awt.application.appearance system property to "system" on macOS for proper AWT/Swing theme following

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

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/theme/Themes.java Outdated
Copy link
Copy Markdown
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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.


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

@Glavo Glavo merged commit 35e6592 into HMCL-dev:main Jan 23, 2026
8 checks passed
@Glavo Glavo deleted the dark-mode branch January 23, 2026 14:44
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.

[Bug] macOS 下深/浅色模式 “跟随系统设置”失效

2 participants