mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-15 14:56:05 -04:00
alt: some UI details
This commit is contained in:
parent
511b555255
commit
f38d3b0026
@ -80,12 +80,15 @@ public class Theme {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String[] getStylesheets() {
|
public String[] getStylesheets() {
|
||||||
|
Color textFill = getForegroundColor();
|
||||||
|
|
||||||
String css;
|
String css;
|
||||||
try {
|
try {
|
||||||
File temp = File.createTempFile("hmcl", ".css");
|
File temp = File.createTempFile("hmcl", ".css");
|
||||||
FileUtils.writeText(temp, IOUtils.readFullyAsString(ResourceNotFoundError.getResourceAsStream("/assets/css/custom.css"))
|
FileUtils.writeText(temp, IOUtils.readFullyAsString(ResourceNotFoundError.getResourceAsStream("/assets/css/custom.css"))
|
||||||
.replace("%base-color%", color)
|
.replace("%base-color%", color)
|
||||||
.replace("%base-rippler-color%", String.format("rgba(%d, %d, %d, 0.3)", (int)Math.ceil(paint.getRed() * 256), (int)Math.ceil(paint.getGreen() * 256), (int)Math.ceil(paint.getBlue() * 256)))
|
.replace("%base-rippler-color%", String.format("rgba(%d, %d, %d, 0.3)", (int)Math.ceil(paint.getRed() * 256), (int)Math.ceil(paint.getGreen() * 256), (int)Math.ceil(paint.getBlue() * 256)))
|
||||||
|
.replace("%disabled-font-color%", String.format("rgba(%d, %d, %d, 0.7)", (int)Math.ceil(textFill.getRed() * 256), (int)Math.ceil(textFill.getGreen() * 256), (int)Math.ceil(textFill.getBlue() * 256)))
|
||||||
.replace("%font-color%", getColorDisplayName(getForegroundColor())));
|
.replace("%font-color%", getColorDisplayName(getForegroundColor())));
|
||||||
css = temp.toURI().toString();
|
css = temp.toURI().toString();
|
||||||
} catch (IOException | NullPointerException e) {
|
} catch (IOException | NullPointerException e) {
|
||||||
|
@ -47,6 +47,7 @@ class DatapackListPageSkin extends SkinBase<DatapackListPage> {
|
|||||||
super(skinnable);
|
super(skinnable);
|
||||||
|
|
||||||
BorderPane root = new BorderPane();
|
BorderPane root = new BorderPane();
|
||||||
|
root.getStyleClass().add("content-background");
|
||||||
JFXListView<DatapackInfoObject> listView = new JFXListView<>();
|
JFXListView<DatapackInfoObject> listView = new JFXListView<>();
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.jackhuang.hmcl.ui.versions;
|
package org.jackhuang.hmcl.ui.versions;
|
||||||
|
|
||||||
|
import javafx.scene.control.Tooltip;
|
||||||
import org.jackhuang.hmcl.setting.Profiles;
|
import org.jackhuang.hmcl.setting.Profiles;
|
||||||
import org.jackhuang.hmcl.setting.Theme;
|
import org.jackhuang.hmcl.setting.Theme;
|
||||||
import org.jackhuang.hmcl.ui.FXUtils;
|
import org.jackhuang.hmcl.ui.FXUtils;
|
||||||
@ -27,18 +28,24 @@ import static org.jackhuang.hmcl.ui.FXUtils.newImage;
|
|||||||
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
import static org.jackhuang.hmcl.util.i18n.I18n.i18n;
|
||||||
|
|
||||||
public class GameAdvancedListItem extends AdvancedListItem {
|
public class GameAdvancedListItem extends AdvancedListItem {
|
||||||
|
private final Tooltip tooltip;
|
||||||
|
|
||||||
public GameAdvancedListItem() {
|
public GameAdvancedListItem() {
|
||||||
|
tooltip = new Tooltip();
|
||||||
|
FXUtils.installFastTooltip(this, tooltip);
|
||||||
|
|
||||||
FXUtils.onChangeAndOperate(Profiles.selectedVersionProperty(), version -> {
|
FXUtils.onChangeAndOperate(Profiles.selectedVersionProperty(), version -> {
|
||||||
if (version != null && Profiles.getSelectedProfile() != null &&
|
if (version != null && Profiles.getSelectedProfile() != null &&
|
||||||
Profiles.getSelectedProfile().getRepository().hasVersion(version)) {
|
Profiles.getSelectedProfile().getRepository().hasVersion(version)) {
|
||||||
setTitle(version);
|
setTitle(version);
|
||||||
setSubtitle(null);
|
setSubtitle(null);
|
||||||
setImage(Profiles.getSelectedProfile().getRepository().getVersionIconImage(version));
|
setImage(Profiles.getSelectedProfile().getRepository().getVersionIconImage(version));
|
||||||
|
tooltip.setText(version);
|
||||||
} else {
|
} else {
|
||||||
setTitle(i18n("version.empty"));
|
setTitle(i18n("version.empty"));
|
||||||
setSubtitle(i18n("version.empty.add"));
|
setSubtitle(i18n("version.empty.add"));
|
||||||
setImage(newImage("/assets/img/grass.png"));
|
setImage(newImage("/assets/img/grass.png"));
|
||||||
|
tooltip.setText("");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ package org.jackhuang.hmcl.ui.versions;
|
|||||||
import com.jfoenix.controls.JFXButton;
|
import com.jfoenix.controls.JFXButton;
|
||||||
import com.jfoenix.controls.JFXPopup;
|
import com.jfoenix.controls.JFXPopup;
|
||||||
import com.jfoenix.effects.JFXDepthManager;
|
import com.jfoenix.effects.JFXDepthManager;
|
||||||
|
import javafx.geometry.Insets;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.SkinBase;
|
import javafx.scene.control.SkinBase;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
@ -56,6 +57,8 @@ public class WorldListItemSkin extends SkinBase<WorldListItem> {
|
|||||||
imageViewContainer.getChildren().setAll(imageView);
|
imageViewContainer.getChildren().setAll(imageView);
|
||||||
|
|
||||||
TwoLineListItem item = new TwoLineListItem();
|
TwoLineListItem item = new TwoLineListItem();
|
||||||
|
item.titleProperty().bind(skinnable.titleProperty());
|
||||||
|
item.subtitleProperty().bind(skinnable.subtitleProperty());
|
||||||
BorderPane.setAlignment(item, Pos.CENTER);
|
BorderPane.setAlignment(item, Pos.CENTER);
|
||||||
center.getChildren().setAll(imageView, item);
|
center.getChildren().setAll(imageView, item);
|
||||||
root.setCenter(center);
|
root.setCenter(center);
|
||||||
@ -81,10 +84,9 @@ public class WorldListItemSkin extends SkinBase<WorldListItem> {
|
|||||||
right.getChildren().add(btnManage);
|
right.getChildren().add(btnManage);
|
||||||
root.setRight(right);
|
root.setRight(right);
|
||||||
|
|
||||||
root.setStyle("-fx-background-color: white; -fx-padding: 8 8 8 0;");
|
root.getStyleClass().add("card");
|
||||||
|
root.setPadding(new Insets(8, 8, 8, 0));
|
||||||
JFXDepthManager.setDepth(root, 1);
|
JFXDepthManager.setDepth(root, 1);
|
||||||
item.titleProperty().bind(skinnable.titleProperty());
|
|
||||||
item.subtitleProperty().bind(skinnable.subtitleProperty());
|
|
||||||
|
|
||||||
getChildren().setAll(root);
|
getChildren().setAll(root);
|
||||||
}
|
}
|
||||||
|
@ -20,5 +20,6 @@
|
|||||||
-fx-base-darker-color: derive(-fx-base-color, -10%);
|
-fx-base-darker-color: derive(-fx-base-color, -10%);
|
||||||
-fx-base-check-color: derive(-fx-base-color, 30%);
|
-fx-base-check-color: derive(-fx-base-color, 30%);
|
||||||
-fx-base-rippler-color: %base-rippler-color%;
|
-fx-base-rippler-color: %base-rippler-color%;
|
||||||
|
-fx-base-disabled-text-fill: %disabled-font-color%;
|
||||||
-fx-base-text-fill: %font-color%;
|
-fx-base-text-fill: %font-color%;
|
||||||
}
|
}
|
@ -181,7 +181,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.tab-label {
|
.tab-label {
|
||||||
-fx-font-family: "Roboto";
|
|
||||||
-fx-font-size: 16;
|
-fx-font-size: 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1058,11 +1057,15 @@
|
|||||||
-fx-font-size: 14;
|
-fx-font-size: 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
.jfx-decorator-tab .tab-label {
|
.jfx-decorator-tab .tab-container .tab-label {
|
||||||
-fx-text-fill: -fx-base-text-fill;
|
-fx-text-fill: -fx-base-disabled-text-fill;
|
||||||
-fx-font-size: 14;
|
-fx-font-size: 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.jfx-decorator-tab .tab-container:selected .tab-label {
|
||||||
|
-fx-text-fill: -fx-base-text-fill;
|
||||||
|
}
|
||||||
|
|
||||||
.resize-border {
|
.resize-border {
|
||||||
-fx-border-color: -fx-base-color;
|
-fx-border-color: -fx-base-color;
|
||||||
-fx-border-width: 0 2 2 2;
|
-fx-border-width: 0 2 2 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user