aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java31
1 files changed, 28 insertions, 3 deletions
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