Class TextEffects
java.lang.Object
net.ixdarklord.coolcatcanvas.api.client.utils.TextEffects
Gradient (rainbow included) and outlined text for GUI drawing.
For a component you build yourself, putting the ColorGradient in its style (ColorGradient.apply(MutableComponent)) is
enough. gradient(FormattedCharSequence, ColorGradient) does the same to text you already have, replacing its
colors, and the result can be kept and handed to anything that draws a FormattedCharSequence (tooltips,
graphics.text, RenderUtils.drawScrollingString(GuiGraphicsExtractor, int, Font, Component, boolean, ScreenRectangle, int, int, boolean)...). The effects combine: an outlined rainbow is
drawOutlinedText(graphics, font, rainbow(text), x, y, -1, 0xFF000000).
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddrawCenteredGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int centerX, int y, ColorGradient gradient, boolean shadow) static voiddrawCenteredOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int centerX, int y, int color, int outlineColor) static voiddrawGradientOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int x, int y, int color, ColorGradient outline) Draws the text with an animated gradient outline.static voiddrawGradientOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.util.FormattedCharSequence text, int x, int y, int color, ColorGradient outline) static voiddrawGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, String text, int x, int y, ColorGradient gradient, boolean shadow) static voiddrawGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int x, int y, ColorGradient gradient, boolean shadow) static voiddrawGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.util.FormattedCharSequence text, int x, int y, ColorGradient gradient, boolean shadow) static voiddrawOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, String text, int x, int y, int color, int outlineColor) static voiddrawOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int x, int y, int color, int outlineColor) static voiddrawOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.util.FormattedCharSequence text, int x, int y, int color, int outlineColor) Draws the text with a one pixel outline around every glyph, like glowing signs.static net.minecraft.util.FormattedCharSequencegradient(net.minecraft.network.chat.Component text, ColorGradient gradient) static net.minecraft.util.FormattedCharSequencegradient(net.minecraft.util.FormattedCharSequence text, ColorGradient gradient) Colors the text with the gradient, replacing the colors of its style (bold, italic and the rest are kept).static net.minecraft.util.FormattedCharSequencerainbow(net.minecraft.network.chat.Component text) The text inColorGradient.RAINBOW.static net.minecraft.util.FormattedCharSequencerainbow(net.minecraft.util.FormattedCharSequence text) The text inColorGradient.RAINBOW.static net.minecraft.util.FormattedCharSequencerecolor(net.minecraft.util.FormattedCharSequence text, int color) Draws every character in one color, whatever colors its style gives it.
-
Method Details
-
rainbow
public static net.minecraft.util.FormattedCharSequence rainbow(net.minecraft.network.chat.Component text) The text inColorGradient.RAINBOW. -
rainbow
public static net.minecraft.util.FormattedCharSequence rainbow(net.minecraft.util.FormattedCharSequence text) The text inColorGradient.RAINBOW. -
gradient
public static net.minecraft.util.FormattedCharSequence gradient(net.minecraft.network.chat.Component text, ColorGradient gradient) -
gradient
public static net.minecraft.util.FormattedCharSequence gradient(net.minecraft.util.FormattedCharSequence text, ColorGradient gradient) Colors the text with the gradient, replacing the colors of its style (bold, italic and the rest are kept). It animates each time it's drawn, so it can be kept. -
recolor
public static net.minecraft.util.FormattedCharSequence recolor(net.minecraft.util.FormattedCharSequence text, int color) Draws every character in one color, whatever colors its style gives it. -
drawGradientText
public static void drawGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, String text, int x, int y, ColorGradient gradient, boolean shadow) -
drawGradientText
public static void drawGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int x, int y, ColorGradient gradient, boolean shadow) -
drawGradientText
public static void drawGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.util.FormattedCharSequence text, int x, int y, ColorGradient gradient, boolean shadow) -
drawCenteredGradientText
public static void drawCenteredGradientText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int centerX, int y, ColorGradient gradient, boolean shadow) -
drawOutlinedText
public static void drawOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, String text, int x, int y, int color, int outlineColor) -
drawOutlinedText
public static void drawOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int x, int y, int color, int outlineColor) -
drawOutlinedText
public static void drawOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.util.FormattedCharSequence text, int x, int y, int color, int outlineColor) Draws the text with a one pixel outline around every glyph, like glowing signs.coloris the base color (the text's own style colors still apply over it); the outline isoutlineColoreverywhere. -
drawGradientOutlinedText
public static void drawGradientOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int x, int y, int color, ColorGradient outline) Draws the text with an animated gradient outline. -
drawGradientOutlinedText
public static void drawGradientOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.util.FormattedCharSequence text, int x, int y, int color, ColorGradient outline) -
drawCenteredOutlinedText
public static void drawCenteredOutlinedText(net.minecraft.client.gui.GuiGraphicsExtractor graphics, net.minecraft.client.gui.Font font, net.minecraft.network.chat.Component text, int centerX, int y, int color, int outlineColor)
-