Skip to content

Feat: Add colors for addon channel icons in DownloadPage#6441

Open
KSSJW wants to merge 5 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:addon-channel-icons
Open

Feat: Add colors for addon channel icons in DownloadPage#6441
KSSJW wants to merge 5 commits into
HMCL-dev:mainfrom
KSSJW-Contribution:addon-channel-icons

Conversation

@KSSJW

@KSSJW KSSJW commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

DownloadPage 中的 addon channel icons 添加了颜色

  • 提高版本类型的辨识度
  • 配色方案取自 Modrinth

实况

更改前 更改后(暗色) 更改后(亮色)
1 2 3

@github-actions github-actions Bot added the 10+ label Jul 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the addon channel icons (Alpha, Beta, and Release) in DownloadPage.java to use specific fill colors. However, the implementation uses string-based CSS lookups (e.g., lookup(".svg")), which is fragile and violates encapsulation. It is recommended to expose a type-safe fill property or method on SVGContainer to safely apply these colors instead.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java Outdated
@KSSJW

KSSJW commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces styling for addon channel icons (Alpha, Beta, and Release) on the download page by assigning specific style classes to the SVG containers and defining their color fills in the CSS. A review comment suggests refactoring the switch-case block in DownloadPage.java to eliminate repetitive code when creating and styling these icons.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java Outdated
@github-actions github-actions Bot added 40+ and removed 10+ labels Jul 20, 2026
@KSSJW

KSSJW commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the rendering of addon channel icons (Alpha, Beta, Release) in the download page by dynamically applying CSS style classes to the SVG icons, and defines the corresponding colors in both light and dark theme stylesheets. A review comment suggests adding a null check for dataItem.versionType() before the switch statement to prevent a potential NullPointerException if the external API returns null.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java Outdated
@KSSJW

KSSJW commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the version type icon rendering in DownloadPage.java by dynamically applying CSS style classes (alpha, beta, release) to the SVG icons and defining their colors in both light and dark theme CSS files. The reviewer suggested refactoring the traditional switch statement to a modern Java 14+ arrow-syntax switch expression to improve readability, prevent fall-through bugs, and maintain consistency with the rest of the codebase.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java
@3gf8jv4dv

Copy link
Copy Markdown
Contributor

这让我想起以前吐槽没有颜色的问题,但当时只解决了字母问题。

#3301

@KSSJW KSSJW left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reviewed

@KSSJW
KSSJW marked this pull request as ready for review July 20, 2026 09:36
@Glavo

Glavo commented Jul 20, 2026

Copy link
Copy Markdown
Member

有必要硬编码颜色吗?尽量映射到颜色角色上吧。

@KSSJW

KSSJW commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

有必要硬编码颜色吗?尽量映射到颜色角色上吧。

比如这样吗?

.addon-channel-icon.alpha .svg {
    -fx-fill: -monet-error;
}

.addon-channel-icon.beta .svg {
    -fx-fill: -monet-tertiary;
}

.addon-channel-icon.release .svg {
    -fx-fill: -monet-primary;
}
暗色 亮色
图片 图片

@3gf8jv4dv

3gf8jv4dv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

errortertiary 的配色表示 alpha / beta 真的合适吗?

CurseForge 和 Modrinth 都使用固定的颜色,个人认为 PR 目前的配色方法 (硬编码) 没什么问题。

另,CurseForge 的 beta 使用紫色,alpha 使用黄色。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants