Class TextFormatter

java.lang.Object
org.strassburger.tui4j.formatting.TextFormatter

public class TextFormatter extends Object
Deprecated.
Use StyledText and Printer instead
Format text with color codes and position text in the terminal
  • Constructor Details

    • TextFormatter

      public TextFormatter()
      Deprecated.
  • Method Details

    • format

      public static String format(String text)
      Deprecated.
      Format text with color codes
      Parameters:
      text - Text with color codes
      Returns:
      Formatted text
    • center

      public static String center(String text)
      Deprecated.
      Center text in the terminal
      Parameters:
      text - Text to center (allows color codes)
      Returns:
      Centered text
    • center

      public static String center(String text, int terminalWidth)
      Deprecated.
      Center text in the terminal
      Parameters:
      text - Text to center (allows color codes)
      terminalWidth - Width of the terminal
      Returns:
      Centered text
    • spaceBetween

      public static String spaceBetween(String text1, String text2)
      Deprecated.
      Add spaces between two texts
      Parameters:
      text1 - First text (allows color codes)
      text2 - Second text (allows color codes)
      Returns:
      Text with spaces between
    • spaceBetween

      public static String spaceBetween(String text1, String text2, String spaceChar)
      Deprecated.
      Add spaces between two texts
      Parameters:
      text1 - First text (allows color codes)
      text2 - Second text (allows color codes)
      spaceChar - Character to use for spaces (allows color codes)
      Returns:
      Text with spaces between
    • spaceBetween

      public static String spaceBetween(String text1, String text2, String spaceChar, int terminalWidth)
      Deprecated.
      Add spaces between two texts Add spaces between two texts
      Parameters:
      text1 - First text (allows color codes)
      text2 - Second text (allows color codes)
      spaceChar - Character to use for spaces (allows color codes)
      terminalWidth - Width of the terminal
      Returns:
      Text with spaces between
    • clearFormatting

      public static String clearFormatting(String text)
      Deprecated.
      Clear formatting from text
      Parameters:
      text - Text with color codes
      Returns:
      Text without color codes
    • gradient

      public static String gradient(String text, String startColor, String endColor)
      Deprecated.
      Add an HSL gradient to text
      Parameters:
      text - Text to add gradient to
      startColor - Start color of the gradient
      endColor - End color of the gradient
      Returns:
      The text formatted with an HSL gradient
    • gradient

      public static <T extends org.strassburger.colorlab4j.color.Color> String gradient(String text, T startColor, T endColor)
      Deprecated.
      Add an HSL gradient to text
      Parameters:
      text - Text to add gradient to
      startColor - Start color of the gradient
      endColor - End color of the gradient
      Returns:
      The text formatted with an HSL gradient
    • gradient

      public static <T extends org.strassburger.colorlab4j.color.Color, U extends org.strassburger.colorlab4j.gradients.Gradient<T>> String gradient(String text, U gradient)
      Deprecated.
      Add a gradient to text
      Parameters:
      text - Text to add gradient to
      gradient - Gradient to apply
      Returns:
      The text formatted with a gradient