Skip to content

Commit 9df185d

Browse files
committed
Improve dropdown visibility
1 parent 8e6e02e commit 9df185d

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

src/main/java/dev/isxander/yacl3/gui/controllers/dropdown/DropdownWidget.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import dev.isxander.yacl3.api.utils.MutableDimension;
55
import dev.isxander.yacl3.gui.YACLScreen;
66
import dev.isxander.yacl3.gui.controllers.ControllerPopupWidget;
7+
import dev.isxander.yacl3.platform.YACLConfig;
78
import net.minecraft.client.gui.GuiGraphicsExtractor;
89
import net.minecraft.client.gui.screens.Screen;
910
import net.minecraft.client.input.CharacterEvent;
@@ -58,24 +59,12 @@ public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mo
5859
if (dropdownLength() == 0) return;
5960

6061
// Background
61-
int x = dropdownDim.x();
62-
int y1 = dropdownDim.y();
63-
int textureWidth = dropdownDim.width();
64-
int textureHeight = dropdownDim.height();
65-
graphics.blit(
66-
RenderPipelines.GUI_TEXTURED,
67-
Screen.MENU_BACKGROUND,
68-
x, y1,
69-
0.0f, 0.0f,
70-
textureWidth, textureHeight,
71-
32, 32,
72-
0xFF3F3F3F
73-
);
62+
graphics.fill(dropdownDim.x(), dropdownDim.y(), dropdownDim.xLimit(), dropdownDim.yLimit(), YACLConfig.HANDLER.instance().dropdownColor.getRGB());
7463
graphics.outline(dropdownDim.x(), dropdownDim.y(), dropdownDim.width(), dropdownDim.height(), -1);
7564

7665
// Highlight the currently selected element
7766
int y = dropdownDim.y() + 2 + entryHeight() * selectedVisibleIndex();
78-
graphics.fill(dropdownDim.x(), y, dropdownDim.xLimit(), y + entryHeight(), 0x7F000000);
67+
graphics.fill(dropdownDim.x(), y, dropdownDim.xLimit(), y + entryHeight(), YACLConfig.HANDLER.instance().dropdownSelectionColor.getRGB());
7968
graphics.outline(dropdownDim.x(), y, dropdownDim.width(), entryHeight(), -1);
8069

8170
// Render all visible elements

src/main/java/dev/isxander/yacl3/platform/YACLConfig.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import dev.isxander.yacl3.config.v2.api.SerialEntry;
55
import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder;
66

7+
import java.awt.Color;
8+
79
public class YACLConfig {
810
public static final ConfigClassHandler<YACLConfig> HANDLER = ConfigClassHandler.createBuilder(YACLConfig.class)
911
.id(YACLPlatform.rl("config"))
@@ -18,4 +20,10 @@ public class YACLConfig {
1820

1921
@SerialEntry(comment = "Load .webp and .gif during Minecraft resource reload instead of on-demand (can decrease startup time)")
2022
public boolean preloadComplexImageFormats = false;
23+
24+
@SerialEntry(comment = "The color (and opacity) of dropdown menus")
25+
public Color dropdownColor = new Color(20, 20, 20, 90);
26+
27+
@SerialEntry(comment = "The color (and opacity) of the selected item in dropdown menus")
28+
public Color dropdownSelectionColor = new Color(0, 0, 0, 160);
2129
}

0 commit comments

Comments
 (0)