public class TextCharacter extends Object
Modifier and Type | Field | Description |
---|---|---|
static TextCharacter |
DEFAULT_CHARACTER |
Constructor | Description |
---|---|
TextCharacter(char character) |
Deprecated.
Use fromCharacter instead
|
TextCharacter(char character,
TextColor foregroundColor,
TextColor backgroundColor,
SGR... styles) |
Deprecated.
Use fromCharacter instead
|
TextCharacter(char character,
TextColor foregroundColor,
TextColor backgroundColor,
EnumSet<SGR> modifiers) |
Deprecated.
Use fromCharacter instead
|
TextCharacter(TextCharacter character) |
Deprecated.
TextCharacters are immutable so you shouldn't need to call this
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object obj) |
|
static TextCharacter[] |
fromCharacter(char c) |
|
static TextCharacter[] |
fromCharacter(char c,
TextColor foregroundColor,
TextColor backgroundColor,
SGR... modifiers) |
|
static TextCharacter[] |
fromString(String string) |
|
static TextCharacter[] |
fromString(String string,
TextColor foregroundColor,
TextColor backgroundColor,
SGR... modifiers) |
|
static TextCharacter[] |
fromString(String string,
TextColor foregroundColor,
TextColor backgroundColor,
EnumSet<SGR> modifiers) |
|
TextColor |
getBackgroundColor() |
Background color specified for this TextCharacter
|
char |
getCharacter() |
Deprecated.
This won't work with advanced characters like emoji
|
String |
getCharacterString() |
Returns the character this TextCharacter represents as a String.
|
TextColor |
getForegroundColor() |
Foreground color specified for this TextCharacter
|
EnumSet<SGR> |
getModifiers() |
Returns a set of all active modifiers on this TextCharacter
|
int |
hashCode() |
|
boolean |
is(char otherCharacter) |
|
boolean |
isBlinking() |
Returns true if this TextCharacter has the blink modifier active
|
boolean |
isBold() |
Returns true if this TextCharacter has the bold modifier active
|
boolean |
isBordered() |
Returns true if this TextCharacter has the bordered modifier active
|
boolean |
isCrossedOut() |
Returns true if this TextCharacter has the crossed-out modifier active
|
boolean |
isDoubleWidth() |
|
boolean |
isItalic() |
Returns true if this TextCharacter has the italic modifier active
|
boolean |
isReversed() |
Returns true if this TextCharacter has the reverse modifier active
|
boolean |
isUnderlined() |
Returns true if this TextCharacter has the underline modifier active
|
String |
toString() |
|
TextCharacter |
withBackgroundColor(TextColor backgroundColor) |
Returns a copy of this TextCharacter with a specified background color
|
TextCharacter |
withCharacter(char character) |
Returns a new TextCharacter with the same colors and modifiers but a different underlying character
|
TextCharacter |
withForegroundColor(TextColor foregroundColor) |
Returns a copy of this TextCharacter with a specified foreground color
|
TextCharacter |
withModifier(SGR modifier) |
Returns a copy of this TextCharacter with an additional SGR modifier.
|
TextCharacter |
withModifiers(Collection<SGR> modifiers) |
Returns a copy of this TextCharacter with specified list of SGR modifiers.
|
TextCharacter |
withoutModifier(SGR modifier) |
Returns a copy of this TextCharacter with an SGR modifier removed.
|
public static final TextCharacter DEFAULT_CHARACTER
@Deprecated public TextCharacter(char character)
ScreenCharacter
based on a supplied character, with default colors and no extra modifiers.character
- Physical character to use@Deprecated public TextCharacter(TextCharacter character)
ScreenCharacter
character
- screenCharacter to copy from@Deprecated public TextCharacter(char character, TextColor foregroundColor, TextColor backgroundColor, SGR... styles)
ScreenCharacter
based on a physical character, color information and optional modifiers.character
- Physical character to refer toforegroundColor
- Foreground color the character hasbackgroundColor
- Background color the character hasstyles
- Optional list of modifiers to apply when drawing the character@Deprecated public TextCharacter(char character, TextColor foregroundColor, TextColor backgroundColor, EnumSet<SGR> modifiers)
ScreenCharacter
based on a physical character, color information and a set of modifiers.character
- Physical character to refer toforegroundColor
- Foreground color the character hasbackgroundColor
- Background color the character hasmodifiers
- Set of modifiers to apply when drawing the characterpublic static TextCharacter[] fromCharacter(char c)
public static TextCharacter[] fromString(String string)
public static TextCharacter[] fromCharacter(char c, TextColor foregroundColor, TextColor backgroundColor, SGR... modifiers)
public static TextCharacter[] fromString(String string, TextColor foregroundColor, TextColor backgroundColor, SGR... modifiers)
public static TextCharacter[] fromString(String string, TextColor foregroundColor, TextColor backgroundColor, EnumSet<SGR> modifiers)
public boolean is(char otherCharacter)
@Deprecated public char getCharacter()
public String getCharacterString()
public TextColor getForegroundColor()
public TextColor getBackgroundColor()
public EnumSet<SGR> getModifiers()
public boolean isBold()
true
if this TextCharacter has the bold modifier activepublic boolean isReversed()
true
if this TextCharacter has the reverse modifier activepublic boolean isUnderlined()
true
if this TextCharacter has the underline modifier activepublic boolean isBlinking()
true
if this TextCharacter has the blink modifier activepublic boolean isBordered()
true
if this TextCharacter has the bordered modifier activepublic boolean isCrossedOut()
true
if this TextCharacter has the crossed-out modifier activepublic boolean isItalic()
true
if this TextCharacter has the italic modifier activepublic TextCharacter withCharacter(char character)
character
- Character the copy should havepublic TextCharacter withForegroundColor(TextColor foregroundColor)
foregroundColor
- Foreground color the copy should havepublic TextCharacter withBackgroundColor(TextColor backgroundColor)
backgroundColor
- Background color the copy should havepublic TextCharacter withModifiers(Collection<SGR> modifiers)
modifiers
- SGR modifiers the copy should havepublic TextCharacter withModifier(SGR modifier)
modifier
- SGR modifiers the copy should have in additional to all currently presentpublic TextCharacter withoutModifier(SGR modifier)
modifier
- SGR modifiers the copy should not havepublic boolean isDoubleWidth()
Copyright © 2020. All rights reserved.