Package org.drasyl.util
Class Ansi
- java.lang.Object
-
- org.drasyl.util.Ansi
-
public final class Ansi extends Object
Utility to colorize and style Strings with ANSI escape sequences.Usage:
String msg1 = ansi().red().onBlue().swap().format("Hello %s", name); String msg2 = ansi().color(MAGENTA).background(GREEN).format("Hello World");
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Ansi.Color
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Ansi
ansi()
Ansi
background(Ansi.Color color)
Ansi
black()
Ansi
blue()
Ansi
bold()
Ansi
color(Ansi.Color color)
Ansi
cyan()
String
format(String format)
String
format(String format, Object... args)
Ansi
green()
Ansi
italic()
Ansi
onBlack()
Ansi
onBlue()
Ansi
onCyan()
Ansi
onGreen()
Ansi
onMagenta()
Ansi
onRed()
Ansi
onWhite()
Ansi
onYellow()
Ansi
purple()
Ansi
red()
Ansi
reset()
Ansi
swap()
Ansi
underline()
Ansi
white()
Ansi
yellow()
-
-
-
Field Detail
-
RESET
public static final String RESET
- See Also:
- Constant Field Values
-
-
Method Detail
-
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, Object... args)
- Throws:
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()
-
-