diff options
author | Falkreon <falkreon@gmail.com> | 2019-07-20 14:06:46 -0500 |
---|---|---|
committer | Falkreon <falkreon@gmail.com> | 2019-07-20 14:06:46 -0500 |
commit | 82a62cf0c992bb0390814a1d12569fa7f05dfcd9 (patch) | |
tree | 3a9cf32a432e9787dd0c42a1ecc22b1f9303f619 | |
parent | 4e9dc24dade8b1214e64cf6f3da4bd2e4c6a5fff (diff) | |
download | LibGui-82a62cf0c992bb0390814a1d12569fa7f05dfcd9.tar.gz LibGui-82a62cf0c992bb0390814a1d12569fa7f05dfcd9.tar.bz2 LibGui-82a62cf0c992bb0390814a1d12569fa7f05dfcd9.zip |
Add darkmode support to WLabel, fix build, add API badge
-rw-r--r-- | build.gradle | 1 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java | 31 | ||||
-rw-r--r-- | src/main/resources/fabric.mod.json | 7 |
3 files changed, 35 insertions, 4 deletions
diff --git a/build.gradle b/build.gradle index 61fbdb2..0baccd4 100644 --- a/build.gradle +++ b/build.gradle @@ -40,6 +40,7 @@ dependencies { include "io.github.cottonmc:Jankson:${project.jankson_version}" compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false } + modCompile "io.github.prospector:modmenu:1.6.3+build.101" // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // You may need to force-disable transitiveness on them. } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java index fb034b8..6c6f82a 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java @@ -1,13 +1,16 @@ package io.github.cottonmc.cotton.gui.widget; +import io.github.cottonmc.cotton.gui.client.LibGuiClient; import io.github.cottonmc.cotton.gui.client.ScreenDrawing; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; public class WLabel extends WWidget { - protected final Text text; - protected final int color; + protected Text text; + protected int color; + protected int darkmodeColor; public static final int DEFAULT_TEXT_COLOR = 0x404040; + public static final int DEFAULT_DARKMODE_TEXT_COLOR = 0xbcbcbc; public WLabel(String text, int color) { this(new LiteralText(text), color); @@ -16,6 +19,7 @@ public class WLabel extends WWidget { public WLabel(Text text, int color) { this.text = text; this.color = color; + this.darkmodeColor = (color==DEFAULT_TEXT_COLOR) ? DEFAULT_DARKMODE_TEXT_COLOR : color; } public WLabel(String text) { @@ -25,7 +29,7 @@ public class WLabel extends WWidget { @Override public void paintBackground(int x, int y) { String translated = text.asFormattedString(); - ScreenDrawing.drawString(translated, x, y, color); + ScreenDrawing.drawString(translated, x, y, LibGuiClient.config.darkMode ? darkmodeColor : color); } @Override @@ -42,4 +46,25 @@ public class WLabel extends WWidget { public int getHeight() { return 8; } + + public WLabel setDarkmodeColor(int color) { + darkmodeColor = color; + return this; + } + + public WLabel disableDarkmode() { + this.darkmodeColor = this.color; + return this; + } + + public WLabel setColor(int color, int darkmodeColor) { + this.color = color; + this.darkmodeColor = darkmodeColor; + return this; + } + + public WLabel setText(Text text) { + this.text = text; + return this; + } }
\ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4e658e7..05faf69 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -18,7 +18,7 @@ "environment": "*", "entrypoints": { "client": [ - "io.github.cottonmc.libgui.client.LibGuiClient" + "io.github.cottonmc.cotton.gui.client.LibGuiClient" ] }, "depends": { @@ -27,5 +27,10 @@ }, "suggests": { "flamingo": "*" + }, + + "custom": { + "modmenu:api": true, + "modmenu:clientsideOnly": false } } |