feat: font family override
This commit is contained in:
@@ -87,9 +87,10 @@ public class Theme {
|
|||||||
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("%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()))
|
||||||
|
.replace("%font%", Optional.ofNullable(System.getProperty("hmcl.font.override")).map(fontFamily -> "-fx-font-family: " + fontFamily + ";").orElse("")));
|
||||||
css = temp.toURI().toString();
|
css = temp.toURI().toString();
|
||||||
} catch (IOException | NullPointerException e) {
|
} catch (IOException | NullPointerException e) {
|
||||||
Logging.LOG.log(Level.SEVERE, "Unable to create theme stylesheet. Fallback to blue theme.", e);
|
Logging.LOG.log(Level.SEVERE, "Unable to create theme stylesheet. Fallback to blue theme.", e);
|
||||||
|
|||||||
@@ -22,4 +22,6 @@
|
|||||||
-fx-base-rippler-color: %base-rippler-color%;
|
-fx-base-rippler-color: %base-rippler-color%;
|
||||||
-fx-base-disabled-text-fill: %disabled-font-color%;
|
-fx-base-disabled-text-fill: %disabled-font-color%;
|
||||||
-fx-base-text-fill: %font-color%;
|
-fx-base-text-fill: %font-color%;
|
||||||
|
|
||||||
|
%font%
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,7 @@ Make sure you have Java installed with Pack200 and JavaFX 8 at least. Liberica f
|
|||||||
|Parameter|Description|
|
|Parameter|Description|
|
||||||
|---------|-----------|
|
|---------|-----------|
|
||||||
|`-Dhmcl.self_integrity_check.disable=true`|Bypass the self integrity check when checking for update.|
|
|`-Dhmcl.self_integrity_check.disable=true`|Bypass the self integrity check when checking for update.|
|
||||||
|
|`-Dhmcl.font.override=<font family>`|Override font family.|
|
||||||
|`-Dhmcl.version.override=<version>`|Override the version number.|
|
|`-Dhmcl.version.override=<version>`|Override the version number.|
|
||||||
|`-Dhmcl.update_source.override=<url>`|Override the update source.|
|
|`-Dhmcl.update_source.override=<url>`|Override the update source.|
|
||||||
|`-Dhmcl.authlibinjector.location=<path>`|Use specified authlib-injector (instead of downloading one).|
|
|`-Dhmcl.authlibinjector.location=<path>`|Use specified authlib-injector (instead of downloading one).|
|
||||||
|
|||||||
Reference in New Issue
Block a user