Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ public void extractRenderState(GuiGraphicsExtractor graphics, int mouseX, int mo

int y = getDimension().y();
ActiveTextCollector textCollector = graphics.textRenderer(GuiGraphicsExtractor.HoveredTextEffects.TOOLTIP_AND_CURSOR);
Style textStyle = Style.EMPTY.withColor(option().available() ? -1 : 0xFFA0A0A0);
Style fallbackStyle = Style.EMPTY.withColor(option().available() ? -1 : 0xFFA0A0A0);
for (FormattedCharSequence text : wrappedText) {
textCollector.accept(
getDimension().x() + getXPadding(),
y + getYPadding(),
GuiUtils.overrideStyle(text, textStyle)
GuiUtils.applyFallbackStyle(text, fallbackStyle)
);
y += textRenderer.lineHeight;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/isxander/yacl3/gui/utils/GuiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public static String shortenString(String string, Font font, int maxWidth, Strin
return string;
}

public static FormattedCharSequence overrideStyle(FormattedCharSequence seq, Style style) {
return output -> seq.accept((c, s, t) -> output.accept(c, style, t));
public static FormattedCharSequence applyFallbackStyle(FormattedCharSequence seq, Style fallback) {
return output -> seq.accept((c, s, t) -> output.accept(c, s.applyTo(fallback), t));
}

public static void setScreen(Screen screen, boolean ignoreVanilla) {
Expand Down