Package com.diogonunes.jcolor
Class Ansi
java.lang.Object
com.diogonunes.jcolor.Ansi
Provides a fluent API to generate
ANSI escape sequences
by specifying
Attribute
s of your format.-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Every Ansi escape code must end with this POSTFIX.static final String
Every Ansi escape code begins with this PREFIX.static final String
Shorthand for the Ansi code that resets to the terminal's default format.static final String
Two options must be separated by this SEPARATOR. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
colorize
(String text, AnsiFormat attributes) static String
static String
static String
generateCode
(AnsiFormat attributes) static String
generateCode
(Attribute... attributes) static String
generateCode
(Command command) static String
makeItFabulous
(String text, Attribute... attributes) Easter egg.
-
Field Details
-
PREFIX
Every Ansi escape code begins with this PREFIX.- See Also:
-
SEPARATOR
Two options must be separated by this SEPARATOR.- See Also:
-
POSTFIX
Every Ansi escape code must end with this POSTFIX.- See Also:
-
RESET
Shorthand for the Ansi code that resets to the terminal's default format.
-
-
Constructor Details
-
Ansi
public Ansi()
-
-
Method Details
-
generateCode
- Parameters:
attributes
- ANSI attributes to format a text.- Returns:
- The ANSI code that describes all those attributes together.
-
generateCode
- Parameters:
attributes
- Object containing format attributes.- Returns:
- The ANSI code that describes all those attributes together.
-
generateCode
- Parameters:
command
- ANSI command to apply to terminal.- Returns:
- The ANSI code that describes that command.
-
colorize
- Parameters:
command
- Ansi command to apply to terminal.- Returns:
- The formatted string, ready to be printed.
-
colorize
- Parameters:
text
- String to format.ansiCode
- Ansi code to format each message's lines.- Returns:
- The formatted string, ready to be printed.
-
colorize
- Parameters:
text
- String to format.attributes
- ANSI attributes to format a text.- Returns:
- The formatted string, ready to be printed.
-
colorize
- Parameters:
text
- String to format.attributes
- Object containing format attributes.- Returns:
- The formatted string, ready to be printed.
-
makeItFabulous
Easter egg. Just an alias of method "colorize".- Parameters:
text
- String to format.attributes
- ANSI attributes to format a text.- Returns:
- The formatted string, ready to be printed.
-