Skip to content

Commit 348798a

Browse files
committed
setter for theme in ui settings
1 parent 633ea7a commit 348798a

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/main/java/com/cleanroommc/modularui/screen/ModularScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ private static Class<?> getGuiActionClass(IGuiAction action) {
685685

686686
public ITheme getCurrentTheme() {
687687
if (this.currentTheme == null) {
688-
useTheme(null);
688+
useTheme(this.context.getUISettings().getTheme());
689689
}
690690
return this.currentTheme;
691691
}

src/main/java/com/cleanroommc/modularui/screen/UISettings.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.minecraft.util.math.BlockPos;
1010

1111
import org.jetbrains.annotations.ApiStatus;
12+
import org.jetbrains.annotations.Nullable;
1213

1314
import java.util.function.Predicate;
1415
import java.util.function.Supplier;
@@ -19,6 +20,7 @@ public class UISettings {
1920

2021
private Supplier<ModularContainer> containerSupplier;
2122
private Predicate<EntityPlayer> canInteractWith;
23+
private String theme;
2224
private final RecipeViewerSettings recipeViewerSettings;
2325

2426
public UISettings() {
@@ -77,6 +79,10 @@ public void canInteractWithinDefaultRange(PosGuiData guiData) {
7779
canInteractWithinRange(guiData, DEFAULT_INTERACT_RANGE);
7880
}
7981

82+
public void useTheme(String theme) {
83+
this.theme = theme;
84+
}
85+
8086
public RecipeViewerSettings getRecipeViewerSettings() {
8187
return recipeViewerSettings;
8288
}
@@ -93,4 +99,8 @@ public boolean hasContainer() {
9399
public boolean canPlayerInteractWithUI(EntityPlayer player) {
94100
return canInteractWith == null || canInteractWith.test(player);
95101
}
102+
103+
public @Nullable String getTheme() {
104+
return theme;
105+
}
96106
}

src/main/java/com/cleanroommc/modularui/test/EventHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public class EventHandler {
3232
.selectedColor(Color.WHITE.main)
3333
.selectedIconColor(Color.RED.brighter(0)))
3434
.widgetThemeHover(IThemeApi.TOGGLE_BUTTON, new SelectableTheme.Builder<>()
35-
.selectedIconColor(Color.DEEP_PURPLE.brighter(0)));
35+
.selectedIconColor(Color.DEEP_PURPLE.brighter(0)))
36+
.textColor(IThemeApi.TEXT_FIELD, Color.DEEP_PURPLE.main);
3637

3738
private static final IIcon tooltipLine = new IDrawable() {
3839
@Override

0 commit comments

Comments
 (0)