public final class TextFormat extends Object implements TextElement
| Modifier and Type | Field and Description |
|---|---|
static TextFormat |
NONE
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyTo(Text.Builder builder)
Applies this element to the end of the specified builder.
|
TextFormat |
color(TextColor color)
Returns a new
TextFormat with the given color. |
boolean |
equals(Object o) |
TextColor |
getColor()
Returns the
TextColor in this format. |
TextStyle |
getStyle()
Returns the
TextStyle in this format. |
int |
hashCode() |
boolean |
isEmpty()
Returns whether this
TextFormat has no color and format
specified. |
TextFormat |
merge(TextFormat format)
Returns a new
TextFormat that combines this and the given format. |
static TextFormat |
of()
Gets the
TextFormat with the default style and color. |
static TextFormat |
of(TextColor color)
Constructs a new
TextFormat with the specific color. |
static TextFormat |
of(TextColor color,
TextStyle style)
Constructs a new
TextFormat with the specific color and style. |
static TextFormat |
of(TextStyle style)
Constructs a new
TextFormat with the specific style. |
TextFormat |
style(TextStyle style)
Returns a new
TextFormat with the given style. |
String |
toString() |
public static final TextFormat NONE
public static TextFormat of()
TextFormat with the default style and color.public static TextFormat of(TextStyle style)
TextFormat with the specific style.style - The stylepublic static TextFormat of(TextColor color)
TextFormat with the specific color.color - The colorpublic static TextFormat of(TextColor color, TextStyle style)
TextFormat with the specific color and style.color - The colorstyle - The stylepublic TextFormat color(TextColor color)
TextFormat with the given color.color - The colorpublic TextFormat style(TextStyle style)
TextFormat with the given style.style - The stylepublic TextFormat merge(TextFormat format)
TextFormat that combines this and the given format.
The given format takes higher priority than this one. Due to this the
color will only fallback to this one if the given format's color is
TextColors.NONE. If the given format's color is
TextColors.RESET then TextColors.NONE will be used.
Styles are combined using TextStyle.and(TextStyle...).format - The format to mergepublic boolean isEmpty()
TextFormat has no color and format
specified.public void applyTo(Text.Builder builder)
TextElementapplyTo in interface TextElementbuilder - Text builder to apply to