Class ANSI

java.lang.Object
fr.diskmth.loggy.ANSI

public class ANSI extends Object
The ANSI class provides a set of static constants and methods to format console output using ANSI escape codes.
Since:
Loggy 1.4
  • Field Details

    • RESET

      public static final ANSI RESET
    • BOLD

      public static final ANSI BOLD
    • ITALIC

      public static final ANSI ITALIC
    • UNDERLINE

      public static final ANSI UNDERLINE
    • REVERSE

      public static final ANSI REVERSE
    • STRIKETHROUGH

      public static final ANSI STRIKETHROUGH
    • BLACK

      public static final ANSI BLACK
    • RED

      public static final ANSI RED
    • GREEN

      public static final ANSI GREEN
    • YELLOW

      public static final ANSI YELLOW
    • BLUE

      public static final ANSI BLUE
    • MAGENTA

      public static final ANSI MAGENTA
    • CYAN

      public static final ANSI CYAN
    • WHITE

      public static final ANSI WHITE
    • BLACK_BRIGHT

      public static final ANSI BLACK_BRIGHT
    • RED_BRIGHT

      public static final ANSI RED_BRIGHT
    • GREEN_BRIGHT

      public static final ANSI GREEN_BRIGHT
    • YELLOW_BRIGHT

      public static final ANSI YELLOW_BRIGHT
    • BLUE_BRIGHT

      public static final ANSI BLUE_BRIGHT
    • MAGENTA_BRIGHT

      public static final ANSI MAGENTA_BRIGHT
    • CYAN_BRIGHT

      public static final ANSI CYAN_BRIGHT
    • WHITE_BRIGHT

      public static final ANSI WHITE_BRIGHT
    • BLACK_BG

      public static final ANSI BLACK_BG
    • RED_BG

      public static final ANSI RED_BG
    • GREEN_BG

      public static final ANSI GREEN_BG
    • YELLOW_BG

      public static final ANSI YELLOW_BG
    • BLUE_BG

      public static final ANSI BLUE_BG
    • MAGENTA_BG

      public static final ANSI MAGENTA_BG
    • CYAN_BG

      public static final ANSI CYAN_BG
    • WHITE_BG

      public static final ANSI WHITE_BG
    • BLACK_BRIGHT_BG

      public static final ANSI BLACK_BRIGHT_BG
    • RED_BRIGHT_BG

      public static final ANSI RED_BRIGHT_BG
    • GREEN_BRIGHT_BG

      public static final ANSI GREEN_BRIGHT_BG
    • YELLOW_BRIGHT_BG

      public static final ANSI YELLOW_BRIGHT_BG
    • BLUE_BRIGHT_BG

      public static final ANSI BLUE_BRIGHT_BG
    • MAGENTA_BRIGHT_BG

      public static final ANSI MAGENTA_BRIGHT_BG
    • CYAN_BRIGHT_BG

      public static final ANSI CYAN_BRIGHT_BG
    • WHITE_BRIGHT_BG

      public static final ANSI WHITE_BRIGHT_BG
    • code

      protected final String code
  • Constructor Details

    • ANSI

      public ANSI(String code)
      Creates an instance of ANSI with the specified code.
      Parameters:
      code - the ANSI code to associate with the instance
  • Method Details

    • multiple

      public static ANSI multiple(ANSI... formats)
      Concatenates multiple ANSI codes into a single ANSI instance.
      Parameters:
      formats - the different ANSI codes to concatenate
      Returns:
      an instance of ANSI with all the codes passed in parameters concatenated
    • format

      public static String format(String message, ANSI... formats)
      Formats a string with the specified ANSI codes.
      Parameters:
      message - the string to format
      formats - the ANSI codes to apply to the string
      Returns:
      the formatted string
    • clearFormat

      public static String clearFormat(String message)
      Removes ANSI formatting codes from a string.
      Parameters:
      message - the string to remove the formatting from
      Returns:
      the string without any ANSI formatting codes
    • getCode

      public String getCode()
      Returns the ANSI code associated with the instance.
      Returns:
      the ANSI code