Interface TextStyle


public interface TextStyle
Represents the styling of the text contained in a component.
  • Method Details

    • of

      static TextStyle 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 color
      backColor - the background color
      decorations - the decorations
      Returns:
      the text style
    • of

      static TextStyle of(@Nullable ComponentColor textColor, @Nullable ComponentColor backColor)
      Creates a new text style with the given colors.
      Parameters:
      textColor - the text color
      backColor - the background color
      Returns:
      the text style
    • of

      static TextStyle of(@Nullable ComponentColor textColor)
      Creates a new text style with the given text color.
      Parameters:
      textColor - the text color
      Returns:
      the text style
    • of

      static TextStyle of(@Nullable ComponentColor textColor, TextDecoration... decorations)
      Creates a new text style with the given text color and decorations.
      Parameters:
      decorations - the decorations
      Returns:
      the text style
    • of

      static TextStyle of(Map<TextDecoration,Boolean> decorations)
      Creates a new text style with the given decorations.
      Parameters:
      decorations - the decorations
      Returns:
      the text style
    • of

      static TextStyle of(TextDecoration... decorations)
      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

      TextStyle setTextColor(@Nullable ComponentColor textColor)
      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

      TextStyle setBackColor(@Nullable ComponentColor backColor)
      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

      TextStyle setDecorations(Map<TextDecoration,Boolean> decorations)
      Sets the decorations.
      Parameters:
      decorations - the decorations
      Returns:
      a new text style with the given decorations
    • addDecoration

      default TextStyle addDecoration(TextDecoration decoration)
      Adds a decoration.
      Parameters:
      decoration - the decoration
      Returns:
      this setter or a copy
    • setDecoration

      default TextStyle setDecoration(TextDecoration decoration, TriState state)
      Sets a decoration state. If the state is TriState.UNDEFINED, the decoration is removed.
      Parameters:
      decoration - the decoration
      state - the state
      Returns:
      a new text style with the given decoration state
    • merge

      TextStyle merge(TextStyle other)
      Merges this text style with another one, overriding existing values.
      Parameters:
      other - the style to merge
      Returns:
      the merged text style