Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7766052
init
Glavo Feb 16, 2026
9f22e57
update
Glavo Feb 16, 2026
bb2829c
update
Glavo Feb 16, 2026
f3e43aa
update
Glavo Feb 16, 2026
d2e55a9
update
Glavo Feb 16, 2026
04543d2
update
Glavo Feb 16, 2026
14cf696
update
Glavo Feb 16, 2026
4dad1b6
update
Glavo Feb 16, 2026
d38c712
update
Glavo Feb 16, 2026
c904347
update
Glavo Feb 16, 2026
8e6acff
Merge remote-tracking branch 'upstream/main' into theme
Glavo Apr 27, 2026
8daf44f
重命名 ThemePack 为 ThemePackManifest 并添加 @JsonSerializable 注解;为 Theme 记录…
Glavo Apr 27, 2026
e29700b
添加 toJson() 方法并补全 ThemeBackground 和 Theme 的文档注释
Glavo Apr 27, 2026
eb92dee
调整 PersonalizationPage:移除主题选择器和背景设置组件,添加主题导航按钮(临时)
Glavo Apr 27, 2026
8ae2d2e
调整 PersonalizationPage 主题按钮:移除临时导航按钮,添加主题选择器变量(未完成)
Glavo Apr 27, 2026
dfee316
添加 ThemeColor2.fromJson() 方法以从 JSON 解析 ThemeColor2
Glavo Apr 27, 2026
cf54bcb
增强 Theme 的 JSON 解析:支持数字对比度值,使用 ThemeColor2.fromJson 处理颜色
Glavo Apr 28, 2026
cd71f0b
重构 Theme 版本号格式为 major.minor,并添加 overrides 序列化
Glavo Apr 28, 2026
a0d9f7a
将 ThemeColor 替换为 ThemeColor2,移除 ThemePackManifest 的 file 字段,调整 ColorT…
Glavo Apr 28, 2026
3104a71
移除旧 ThemeColor 类,完成 ThemeColor2 重命名,并迁移相关方法至 FXUtils
Glavo Apr 28, 2026
c39f3a1
将 theme2 包重命名为 theme,更新所有引用和导入
Glavo Apr 28, 2026
257009f
为 ThemeColor 添加 @NotNullByDefault 注解并标记 of 参数可为空
Glavo Apr 28, 2026
b206ab5
重命名 ThemePackManifest 为 ThemePack,将 theme 方法重命名为 colorTheme
Glavo Apr 28, 2026
08ee256
添加 ObservableList<Theme> themes 及 getThemes 方法
Glavo Apr 28, 2026
b64e251
添加浅色/深色主题选择器及修改按钮,移除未使用的 themeSublist 变量
Glavo Apr 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed HMCL/image/april_fools.png
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public Response serve(IHTTPSession session) {
String html;
try {
html = IOUtils.readFullyAsString(OAuthServer.class.getResourceAsStream("/assets/microsoft_auth.html"))
.replace("%style%", Themes.getTheme().toColorScheme().toStyleSheet().replace("-monet", "--monet"))
.replace("%style%", Themes.getColorScheme().toStyleSheet().replace("-monet", "--monet"))
.replace("%lang%", Locale.getDefault().toLanguageTag())
.replace("%success%", i18n("message.success"))
.replace("%ok%", i18n("button.ok"))
Expand Down
12 changes: 6 additions & 6 deletions HMCL/src/main/java/org/jackhuang/hmcl/setting/StyleSheets.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
import org.glavo.monetfx.Brightness;
import org.glavo.monetfx.ColorRole;
import org.glavo.monetfx.ColorScheme;
import org.jackhuang.hmcl.theme.Theme;
import org.jackhuang.hmcl.theme.ThemeColor;
import org.jackhuang.hmcl.theme.ColorTheme;
import org.jackhuang.hmcl.theme.Themes;
import org.jackhuang.hmcl.ui.FXUtils;

Expand Down Expand Up @@ -144,24 +143,25 @@ private static String getBrightnessStyleSheet() {

private static void addColor(StringBuilder builder, String name, Color color) {
builder.append(" ").append(name)
.append(": ").append(ThemeColor.getColorDisplayName(color)).append(";\n");
.append(": ").append(FXUtils.getColorDisplayName(color)).append(";\n");
}

private static void addColor(StringBuilder builder, String name, Color color, double opacity) {
builder.append(" ").append(name)
.append(": ").append(ThemeColor.getColorDisplayNameWithOpacity(color, opacity)).append(";\n");
.append(": ").append(FXUtils.getColorDisplayNameWithOpacity(color, opacity)).append(";\n");
}

private static void addColor(StringBuilder builder, ColorScheme scheme, ColorRole role, double opacity) {
Color c = scheme.getColor(role);
builder.append(" ").append(role.getVariableName()).append("-transparent-%02d".formatted((int) (100 * opacity)))
.append(": ").append(ThemeColor.getColorDisplayNameWithOpacity(scheme.getColor(role), opacity))
.append(": ").append(FXUtils.getColorDisplayNameWithOpacity(c, opacity))
.append(";\n");
}

private static String getThemeStyleSheet() {
final String blueCss = "/assets/css/blue.css";

if (Theme.DEFAULT.equals(Themes.getTheme()))
if (ColorTheme.DEFAULT.equals(Themes.getColorTheme()))
return blueCss;

ColorScheme scheme = Themes.getColorScheme();
Expand Down
41 changes: 41 additions & 0 deletions HMCL/src/main/java/org/jackhuang/hmcl/theme/ColorTheme.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Hello Minecraft! Launcher
* Copyright (C) 2025 huangyuhui <huanghongxun2008@126.com> and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.jackhuang.hmcl.theme;

import javafx.scene.paint.Color;
import org.glavo.monetfx.*;

/// @author Glavo
public record ColorTheme(
Color primaryColorSeed,
Brightness brightness,
ColorStyle colorStyle,
Contrast contrast) {

public static final ColorTheme DEFAULT = new ColorTheme(ThemeColor.DEFAULT.color(), Brightness.DEFAULT, ColorStyle.FIDELITY, Contrast.DEFAULT);

public ColorScheme toColorScheme() {
return ColorScheme.newBuilder()
.setPrimaryColorSeed(primaryColorSeed)
.setColorStyle(colorStyle)
.setBrightness(brightness)
.setSpecVersion(ColorSpecVersion.SPEC_2025)
.setContrast(contrast)
.build();
}
}
Loading
Loading