Class Ansi


@UnstableApi public final class Ansi extends Object
Utility to colorize and style Strings with ANSI escape sequences.


 String msg1 = ansi().red().onBlue().swap().format("Hello %s", name);
 String msg2 = ansi().color(MAGENTA).background(GREEN).format("Hello World");
  • Method Details

    • reset

      public Ansi reset()
    • color

      public Ansi color(Ansi.Color color)
    • black

      public Ansi black()
    • red

      public Ansi red()
    • green

      public Ansi green()
    • yellow

      public Ansi yellow()
    • blue

      public Ansi blue()
    • purple

      public Ansi purple()
    • cyan

      public Ansi cyan()
    • white

      public Ansi white()
    • background

      public Ansi background(Ansi.Color color)
    • onBlack

      public Ansi onBlack()
    • onRed

      public Ansi onRed()
    • onGreen

      public Ansi onGreen()
    • onYellow

      public Ansi onYellow()
    • onBlue

      public Ansi onBlue()
    • onMagenta

      public Ansi onMagenta()
    • onCyan

      public Ansi onCyan()
    • onWhite

      public Ansi onWhite()
    • bold

      public Ansi bold()
    • italic

      public Ansi italic()
    • underline

      public Ansi underline()
    • swap

      public Ansi swap()
    • format

      public String format(String format)
    • format

      public String format(String format, Object... args)
      IllegalFormatException - If a format string contains an illegal syntax, a format specifier that is incompatible with the given arguments, insufficient arguments given the format string, or other illegal conditions.
    • ansi

      public static Ansi ansi()