Interface TextStyle
public interface TextStyle
Represents the styling of the text contained in a component.
-
Method Summary
Modifier and TypeMethodDescriptiondefault TextStyleaddDecoration(TextDecoration decoration) Adds a decoration.@Nullable ComponentColorReturns the background color of this style.Returns the decorations of this style.@Nullable ComponentColorReturns the text color of this style.Merges this text style with another one, overriding existing values.static TextStyleof()Returns a text style with no styling.static TextStyleof(@Nullable ComponentColor textColor) Creates a new text style with the given text color.static TextStyleof(@Nullable ComponentColor textColor, @Nullable ComponentColor backColor) Creates a new text style with the given colors.static TextStyleof(@Nullable ComponentColor textColor, @Nullable ComponentColor backColor, Map<TextDecoration, Boolean> decorations) Creates a new text style with the given colors and decorations.static TextStyleof(@Nullable ComponentColor textColor, TextDecoration... decorations) Creates a new text style with the given text color and decorations.static TextStyleof(TextDecoration... decorations) Creates a new text style with the given decorations.static TextStyleof(Map<TextDecoration, Boolean> decorations) Creates a new text style with the given decorations.setBackColor(@Nullable ComponentColor backColor) Sets the background color.default TextStylesetDecoration(TextDecoration decoration, TriState state) Sets a decoration state.setDecorations(Map<TextDecoration, Boolean> decorations) Sets the decorations.setTextColor(@Nullable ComponentColor textColor) Sets the text color.
-
Method Details
-
of
Returns a text style with no styling. -
of
static TextStyle of(@Nullable ComponentColor textColor, @Nullable ComponentColor backColor, Map<TextDecoration, Boolean> decorations) Creates a new text style with the given colors and decorations.- Parameters:
textColor- the text colorbackColor- the background colordecorations- the decorations- Returns:
- the text style
-
of
Creates a new text style with the given colors.- Parameters:
textColor- the text colorbackColor- the background color- Returns:
- the text style
-
of
Creates a new text style with the given text color.- Parameters:
textColor- the text color- Returns:
- the text style
-
of
Creates a new text style with the given text color and decorations.- Parameters:
decorations- the decorations- Returns:
- the text style
-
of
Creates a new text style with the given decorations.- Parameters:
decorations- the decorations- Returns:
- the text style
-
of
Creates a new text style with the given decorations.- Parameters:
decorations- the decorations- Returns:
- the text style
-
getTextColor
@Nullable ComponentColor getTextColor()Returns the text color of this style. -
setTextColor
Sets the text color.- Parameters:
textColor- the text color- Returns:
- a new text style with the given text color
-
getBackColor
@Nullable ComponentColor getBackColor()Returns the background color of this style. -
setBackColor
Sets the background color.- Parameters:
backColor- the background color- Returns:
- a new text style with the given background color
-
getDecorations
Map<TextDecoration,Boolean> getDecorations()Returns the decorations of this style. -
setDecorations
Sets the decorations.- Parameters:
decorations- the decorations- Returns:
- a new text style with the given decorations
-
addDecoration
Adds a decoration.- Parameters:
decoration- the decoration- Returns:
- this setter or a copy
-
setDecoration
Sets a decoration state. If the state isTriState.UNDEFINED, the decoration is removed.- Parameters:
decoration- the decorationstate- the state- Returns:
- a new text style with the given decoration state
-
merge
Merges this text style with another one, overriding existing values.- Parameters:
other- the style to merge- Returns:
- the merged text style
-