Skip to content

Commit 50111bb

Browse files
committed
add info on selected mode to config screen
- improve text readability
1 parent d54d1a8 commit 50111bb

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- optimise config reading and writing
22
- optimise colour lookups (improvements to in game performance)
33
- mixin compatibility improvements
4-
- improve config file with prettier screen and more info
4+
- config screen now displays the currently enabled colours, the colours in the currently selected mode, and is prettier

src/main/java/io/ix0rai/rainglow/config/RainglowConfigScreen.java

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@ public class RainglowConfigScreen extends SpruceScreen {
2626
private final SpruceOption resetOption;
2727
private RainglowMode mode;
2828

29+
private SpruceLabelWidget coloursToApplyLabel;
30+
2931
public RainglowConfigScreen(@Nullable Screen parent) {
3032
super(Rainglow.translatableText("config.title"));
3133
this.parent = parent;
3234
this.mode = Rainglow.CONFIG.getMode();
3335

3436
this.modeOption = new SpruceCyclingOption(Rainglow.translatableTextKey("config.mode"),
35-
amount -> mode = mode.cycle(),
37+
amount -> {
38+
mode = mode.cycle();
39+
this.remove(coloursToApplyLabel);
40+
StringBuilder coloursToApply = new StringBuilder(Language.getInstance().get(Rainglow.translatableTextKey("config.colours_to_apply")));
41+
appendColours(coloursToApply, this.mode);
42+
Style style = Style.EMPTY.withColor(this.mode.getText().getStyle().getColor());
43+
this.coloursToApplyLabel = new SpruceLabelWidget(Position.of(this, this.width / 2 - 108, this.height / 4 + 20), Text.literal(coloursToApply.toString()).setStyle(style), this.width, true);
44+
this.addDrawableChild(coloursToApplyLabel);
45+
},
3646
option -> option.getDisplayText(mode.getText()),
3747
Rainglow.translatableText("tooltip.mode",
3848
List.of(RainglowMode.values())
@@ -72,11 +82,17 @@ protected void init() {
7282
this.addDrawableChild(this.customOption.createWidget(Position.of(this.width / 2 + 5, this.height / 6 - buttonHeight + buttonOffset), 200));
7383

7484
this.addDrawableChild(new SpruceLabelWidget(Position.of(this, 0, this.height / 9), Rainglow.translatableText("config.title"), this.width, true));
85+
7586
StringBuilder text = new StringBuilder(Language.getInstance().get(Rainglow.translatableTextKey("config.current_colours")));
76-
for (SquidColour colour : Rainglow.CONFIG.getMode().getColours()) {
77-
text.append("\n").append(Language.getInstance().get(Rainglow.translatableTextKey("colour." + colour.getId())));
78-
}
79-
this.addDrawableChild(new SpruceLabelWidget(Position.of(this, 0, this.height / 4 + buttonHeight), Text.of(text.toString()).copy().setStyle(Style.EMPTY.withColor(Rainglow.CONFIG.getMode().getText().getStyle().getColor())), this.width, true));
87+
appendColours(text, Rainglow.CONFIG.getMode());
88+
Style style = Style.EMPTY.withColor(Rainglow.CONFIG.getMode().getText().getStyle().getColor());
89+
this.addDrawableChild(new SpruceLabelWidget(Position.of(this, this.width / 2 - 318, this.height / 4 + buttonHeight), Text.literal(text.toString()).setStyle(style), this.width, true));
90+
91+
StringBuilder coloursToApply = new StringBuilder(Language.getInstance().get(Rainglow.translatableTextKey("config.colours_to_apply")));
92+
appendColours(coloursToApply, this.mode);
93+
style = Style.EMPTY.withColor(this.mode.getText().getStyle().getColor());
94+
this.coloursToApplyLabel = new SpruceLabelWidget(Position.of(this, this.width / 2 - 108, this.height / 4 + buttonHeight), Text.literal(coloursToApply.toString()).setStyle(style), this.width, true);
95+
this.addDrawableChild(coloursToApplyLabel);
8096

8197
this.addDrawableChild(this.resetOption.createWidget(Position.of(this, this.width / 2 - 155, this.height - 29), 150));
8298
this.addDrawableChild(new SpruceButtonWidget(Position.of(this, this.width / 2 - 155 + 160, this.height - 29), 150,
@@ -87,4 +103,10 @@ protected void init() {
87103
}
88104
));
89105
}
106+
107+
private void appendColours(StringBuilder text, RainglowMode mode) {
108+
for (SquidColour colour : mode.getColours()) {
109+
text.append("\n").append(Language.getInstance().get(Rainglow.translatableTextKey("colour." + colour.getId())));
110+
}
111+
}
90112
}

src/main/java/io/ix0rai/rainglow/config/RainglowMode.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public enum RainglowMode {
3535
SquidColour.PINK,
3636
SquidColour.PURPLE
3737
),
38-
BI_PRIDE(Rainglow.translatableText("mode.bi_pride"), TextColor.fromRgb(0x292784),
38+
BI_PRIDE(Rainglow.translatableText("mode.bi_pride"), TextColor.fromRgb(0x0063A0),
3939
SquidColour.BLUE,
4040
SquidColour.PINK,
4141
SquidColour.PURPLE
@@ -62,7 +62,7 @@ public enum RainglowMode {
6262
SquidColour.WHITE,
6363
SquidColour.GREEN
6464
),
65-
ENBY_PRIDE(Rainglow.translatableText("mode.enby_pride"), TextColor.fromRgb(0x531F82),
65+
ENBY_PRIDE(Rainglow.translatableText("mode.enby_pride"), TextColor.fromRgb(0x705CA8),
6666
SquidColour.YELLOW,
6767
SquidColour.WHITE,
6868
SquidColour.BLACK,
@@ -84,6 +84,7 @@ public enum RainglowMode {
8484
SquidColour.BLUE
8585
),
8686
CUSTOM(Rainglow.translatableText("mode.custom"), TextColor.fromRgb(0x00FFE1));
87+
8788
private static final Map<String, RainglowMode> BY_ID = new HashMap<>();
8889

8990
static {

src/main/resources/assets/rainglow/lang/en_us.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"rainglow.config.title": "Rainglow Configuration",
33
"rainglow.config.current_colours": "Currently enabled colours:",
4+
"rainglow.config.colours_to_apply": "Colours to apply:",
45
"rainglow.config.mode": "Mode",
56
"rainglow.config.save": "Save",
67
"rainglow.config.clear": "Clear",

0 commit comments

Comments
 (0)