Skip to content

修复部分控件在深色模式下颜色异常的问题#4899

Merged
Glavo merged 26 commits intoHMCL-dev:mainfrom
Glavo:color
Dec 2, 2025
Merged

修复部分控件在深色模式下颜色异常的问题#4899
Glavo merged 26 commits intoHMCL-dev:mainfrom
Glavo:color

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Dec 1, 2025

No description provided.

@Glavo Glavo linked an issue Dec 1, 2025 that may be closed by this pull request
@Glavo Glavo linked an issue Dec 1, 2025 that may be closed by this pull request
@Glavo Glavo marked this pull request as ready for review December 2, 2025 08:55
@Glavo Glavo requested a review from Copilot December 2, 2025 12:17
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 systematically fixes color rendering issues in dark mode by refactoring hardcoded colors to use CSS theme variables. The changes introduce a brightness-specific stylesheet system and migrate color values from Java code to CSS, ensuring proper theming support across light and dark modes.

Key Changes

  • Introduced brightness-specific stylesheets: Created brightness-light.css and brightness-dark.css files with -fixed- prefixed CSS variables for colors that differ between light and dark modes
  • Removed hardcoded colors from Java: Eliminated direct color assignments in Java code (e.g., Color.web("#0070E0")) in favor of CSS styling
  • Enhanced dynamic color binding: Implemented proper property binding for UI elements that need to react to theme changes (e.g., title text fill)

Reviewed changes

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

Show a summary per file
File Description
HMCLCore/src/main/java/org/jackhuang/hmcl/util/Log4jLevel.java Removed unused Color constants and getColor() method from enum
HMCL/src/main/resources/assets/css/root.css Replaced hardcoded color values with CSS theme variables; added brightness-agnostic styles
HMCL/src/main/resources/assets/css/brightness-light.css New file defining light mode specific colors using -fixed- prefix
HMCL/src/main/resources/assets/css/brightness-dark.css New file defining dark mode specific colors using -fixed- prefix
HMCL/src/main/resources/assets/css/blue.css Removed hardcoded -warning-tag-background (now in brightness files)
HMCL/src/main/java/org/jackhuang/hmcl/ui/terracotta/TerracottaControllerPage.java Added style classes for CSS targeting; contains one hardcoded color that needs fixing
HMCL/src/main/java/org/jackhuang/hmcl/ui/main/MainPage.java Bound title text fill to dynamic theme property
HMCL/src/main/java/org/jackhuang/hmcl/ui/decorator/DecoratorSkin.java Bound title text fill to dynamic theme property
HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/IconedMenuItem.java Added size limiting for icon consistency
HMCL/src/main/java/org/jackhuang/hmcl/ui/LogWindow.java Migrated log level colors from Java to CSS class-based styling
HMCL/src/main/java/org/jackhuang/hmcl/ui/FXUtils.java Removed hardcoded hyperlink color to use CSS styling
HMCL/src/main/java/org/jackhuang/hmcl/theme/Themes.java Implemented dynamic title fill property with transparency support
HMCL/src/main/java/org/jackhuang/hmcl/setting/StyleSheets.java Added brightness stylesheet loading and update logic
HMCL/src/main/java/com/jfoenix/skins/JFXCustomColorPickerDialog.java Commented out hardcoded color logic (replaced by CSS)
HMCL/src/main/java/com/jfoenix/skins/JFXColorPickerSkin.java Refactored to use properties for proper binding and CSS compatibility

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

@Glavo Glavo merged commit a1e75e4 into HMCL-dev:main Dec 2, 2025
2 checks passed
@Glavo Glavo deleted the color branch December 2, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants