Skip to content

Commit 68fc2d7

Browse files
authored
修复部分控件颜色错误的问题 (#4887)
1 parent cda45db commit 68fc2d7

4 files changed

Lines changed: 33 additions & 21 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/setting/StyleSheets.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ private static void addColor(StringBuilder builder, String name, Color color, do
142142
}
143143

144144
private static void addColor(StringBuilder builder, ColorScheme scheme, ColorRole role, double opacity) {
145-
builder.append(" ").append(role.getVariableName()).append("-transparent-").append((int) (100 * opacity))
145+
builder.append(" ").append(role.getVariableName()).append("-transparent-%02d".formatted((int) (100 * opacity)))
146146
.append(": ").append(ThemeColor.getColorDisplayNameWithOpacity(scheme.getColor(role), opacity))
147147
.append(";\n");
148148
}

HMCL/src/main/java/org/jackhuang/hmcl/ui/GameCrashWindow.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ private void exportGameCrashInfo() {
292292
private final class View extends VBox {
293293

294294
View() {
295-
setStyle("-fx-background-color: white");
295+
this.getStyleClass().add("game-crash-window");
296296

297297
HBox titlePane = new HBox();
298298
{
@@ -395,6 +395,7 @@ private final class View extends VBox {
395395
reasonTitle.getStyleClass().add("two-line-item-second-large-title");
396396

397397
ScrollPane reasonPane = new ScrollPane(reasonTextFlow);
398+
reasonTextFlow.getStyleClass().add("crash-reason-text-flow");
398399
reasonPane.setFitToWidth(true);
399400
reasonPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER);
400401
reasonPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED);
@@ -411,6 +412,7 @@ private final class View extends VBox {
411412
}
412413

413414
HBox toolBar = new HBox();
415+
VBox.setMargin(toolBar, new Insets(0, 0, 4, 0));
414416
{
415417
JFXButton exportGameCrashInfoButton = FXUtils.newRaisedButton(i18n("logwindow.export_game_crash_logs"));
416418
exportGameCrashInfoButton.setOnAction(e -> exportGameCrashInfo());
@@ -422,7 +424,6 @@ private final class View extends VBox {
422424
helpButton.setOnAction(e -> FXUtils.openLink(Metadata.CONTACT_URL));
423425
FXUtils.installFastTooltip(helpButton, i18n("logwindow.help"));
424426

425-
426427
toolBar.setPadding(new Insets(8));
427428
toolBar.setSpacing(8);
428429
toolBar.getStyleClass().add("jfx-tool-bar");

HMCL/src/main/java/org/jackhuang/hmcl/ui/construct/TaskExecutorDialogPane.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public TaskExecutorDialogPane(@NotNull TaskCancellationAction cancel) {
7676
bottom.setLeft(lblProgress);
7777

7878
btnCancel = new JFXButton(i18n("button.cancel"));
79+
btnCancel.getStyleClass().add("dialog-cancel");
7980
bottom.setRight(btnCancel);
8081
}
8182

HMCL/src/main/resources/assets/css/root.css

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
* along with this program. If not, see <https://www.gnu.org/licenses/>.
1717
*/
1818

19-
/* TODO: Monet */
2019
.root {
21-
-fx-base-check-color: derive(-monet-primary-container, 30%);
22-
-fx-base-text-fill: -monet-on-primary-container;
2320
}
2421

2522
.svg {
@@ -156,10 +153,6 @@
156153
-jfx-rippler-fill: #a2a2a2;
157154
}
158155

159-
.rippler-container:selected .label {
160-
-fx-text-fill: -fx-base-text-fill;
161-
}
162-
163156
.advanced-list-item > .rippler-container > .container {
164157
-fx-padding: 10 16 10 16;
165158
-fx-background-color: null;
@@ -317,16 +310,28 @@
317310
}
318311

319312
.two-line-item-second-large > .first-line > .title, .two-line-item-second-large-title {
320-
-fx-text-fill: rgba(0, 0, 0, 0.5);
313+
-fx-text-fill: -monet-on-surface-variant;
321314
-fx-font-weight: normal;
322315
-fx-font-size: 12px;
323316
}
324317

325318
.two-line-item-second-large > HBox > .subtitle {
326-
-fx-text-fill: #292929;
319+
-fx-text-fill: -monet-on-surface;
327320
-fx-font-size: 15px;
328321
}
329322

323+
.game-crash-window {
324+
-fx-background-color: -monet-surface-container;
325+
}
326+
327+
.game-crash-window .crash-reason-text-flow Text {
328+
-fx-fill: -monet-on-surface;
329+
}
330+
331+
.game-crash-window .crash-reason-text-flow .hyperlink {
332+
-fx-fill: #0070E0;
333+
}
334+
330335
.wrap-text > HBox > .subtitle {
331336
-fx-wrap-text: true;
332337
}
@@ -395,6 +400,10 @@
395400
-fx-font-size: 14px;
396401
}
397402

403+
.launch-pane .svg {
404+
-fx-fill: -monet-on-primary-container;
405+
}
406+
398407
.launch-pane > Rectangle {
399408
-fx-fill: -monet-primary-container;
400409
}
@@ -417,15 +426,16 @@
417426
******************************************************************************/
418427

419428
.tab-header-background {
420-
-fx-background-color: -fx-base-check-color;
429+
-fx-background-color: -monet-surface;
421430
}
422431

423432
.tab-selected-line {
424433
-fx-background-color: derive(-monet-primary-container, -30%);
425434
}
426435

436+
/* TODO: It seems not actually used */
427437
.tab-rippler {
428-
-jfx-rippler-fill: -fx-base-check-color;
438+
-jfx-rippler-fill: derive(-monet-primary-container, 30%);
429439
}
430440

431441
.jfx-tab-pane .jfx-rippler {
@@ -585,7 +595,7 @@
585595
}
586596

587597
.jfx-tool-bar .jfx-decorator-button .svg {
588-
-fx-fill: -fx-base-text-fill;
598+
-fx-fill: -monet-on-primary-container;
589599
}
590600

591601
.jfx-tool-bar Label {
@@ -611,13 +621,13 @@
611621
.jfx-tool-bar-second {
612622
-fx-pref-height: 42;
613623
-fx-padding: 2 2 2 2;
614-
-fx-background-color: -fx-base-check-color;
624+
-fx-background-color: -monet-primary-container;
615625
-fx-alignment: CENTER-LEFT;
616626
-fx-spacing: 8;
617627
}
618628

619629
.jfx-tool-bar-second .label {
620-
-fx-text-fill: -fx-base-text-fill;
630+
-fx-text-fill: -monet-on-primary-container;
621631
-fx-font-size: 16;
622632
-fx-font-weight: bold;
623633
}
@@ -851,7 +861,7 @@
851861

852862
/*.list-cell:odd:selected > .jfx-rippler > StackPane,*/
853863
/*.list-cell:even:selected > .jfx-rippler > StackPane {*/
854-
/* -fx-background-color: derive(-fx-base-check-color, 30%);*/
864+
/* -fx-background-color: derive(-monet-primary, 30%);*/
855865
/*}*/
856866

857867
.jfx-list-view {
@@ -1143,7 +1153,7 @@
11431153
-fx-min-height: -fx-toggle-icon-tiny-size;
11441154
-fx-background-radius: 25px;
11451155
-fx-background-color: transparent;
1146-
-jfx-toggle-color: -fx-base-check-color;
1156+
-jfx-toggle-color: -monet-primary;
11471157
-jfx-untoggle-color: transparent;
11481158
}
11491159

@@ -1153,7 +1163,7 @@
11531163
}
11541164

11551165
.toggle-icon-tiny .jfx-rippler {
1156-
-jfx-rippler-fill: -fx-base-check-color;
1166+
-jfx-rippler-fill: -monet-primary;
11571167
-jfx-mask-type: CIRCLE;
11581168
}
11591169

@@ -1170,7 +1180,7 @@
11701180
}
11711181

11721182
.announcement-close-button .jfx-rippler {
1173-
-jfx-rippler-fill: -fx-base-check-color;
1183+
-jfx-rippler-fill: -monet-primary;
11741184
-jfx-mask-type: CIRCLE;
11751185
}
11761186

0 commit comments

Comments
 (0)