Package nz.org.riskscape.picocli
Enum Class CommandLine.Help.Ansi.Style
- All Implemented Interfaces:
Serializable
,Comparable<CommandLine.Help.Ansi.Style>
,Constable
,CommandLine.Help.Ansi.IStyle
- Enclosing class:
- CommandLine.Help.Ansi
public static enum CommandLine.Help.Ansi.Style
extends Enum<CommandLine.Help.Ansi.Style>
implements CommandLine.Help.Ansi.IStyle
A set of pre-defined ANSI escape code styles and colors, and a set of convenience methods for parsing text with embedded markup style names, as well as convenience methods for converting styles to strings with embedded escape codes.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
Fields inherited from interface nz.org.riskscape.picocli.CommandLine.Help.Ansi.IStyle
CSI
-
Method Summary
Modifier and TypeMethodDescriptionstatic CommandLine.Help.Ansi.IStyle
Parses the specified style markup and returns the associated style.static CommandLine.Help.Ansi.IStyle
Parses the specified style markup and returns the associated style.off()
Returns the ANSI escape code for turning this style off.static String
off
(CommandLine.Help.Ansi.IStyle... styles) Returns the concatenated ANSI escape codes for turning all specified styles off.on()
Returns the ANSI escape code for turning this style on.static String
on
(CommandLine.Help.Ansi.IStyle... styles) Returns the concatenated ANSI escape codes for turning all specified styles on.static CommandLine.Help.Ansi.IStyle[]
Parses the specified comma-separated sequence of style descriptors and returns the associated styles.static CommandLine.Help.Ansi.Style
Returns the enum constant of this class with the specified name.static CommandLine.Help.Ansi.Style[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
reset
-
bold
-
faint
-
italic
-
underline
-
blink
-
reverse
-
fg_black
-
fg_red
-
fg_green
-
fg_yellow
-
fg_blue
-
fg_magenta
-
fg_cyan
-
fg_white
-
bg_black
-
bg_red
-
bg_green
-
bg_yellow
-
bg_blue
-
bg_magenta
-
bg_cyan
-
bg_white
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
on
Description copied from interface:CommandLine.Help.Ansi.IStyle
Returns the ANSI escape code for turning this style on.- Specified by:
on
in interfaceCommandLine.Help.Ansi.IStyle
- Returns:
- the ANSI escape code for turning this style on
-
off
Description copied from interface:CommandLine.Help.Ansi.IStyle
Returns the ANSI escape code for turning this style off.- Specified by:
off
in interfaceCommandLine.Help.Ansi.IStyle
- Returns:
- the ANSI escape code for turning this style off
-
on
Returns the concatenated ANSI escape codes for turning all specified styles on.- Parameters:
styles
- the styles to generate ANSI escape codes for- Returns:
- the concatenated ANSI escape codes for turning all specified styles on
-
off
Returns the concatenated ANSI escape codes for turning all specified styles off.- Parameters:
styles
- the styles to generate ANSI escape codes for- Returns:
- the concatenated ANSI escape codes for turning all specified styles off
-
fg
Parses the specified style markup and returns the associated style. The markup may be one of the Style enum value names, or it may be one of the Style enum value names when"fg_"
is prepended, or it may be one of the indexed colors in the 256 color palette.- Parameters:
str
- the case-insensitive style markup to convert, e.g."blue"
or"fg_blue"
, or"46"
(indexed color) or"0;5;0"
(RGB components of an indexed color)- Returns:
- the IStyle for the specified converter
-
bg
Parses the specified style markup and returns the associated style. The markup may be one of the Style enum value names, or it may be one of the Style enum value names when"bg_"
is prepended, or it may be one of the indexed colors in the 256 color palette.- Parameters:
str
- the case-insensitive style markup to convert, e.g."blue"
or"bg_blue"
, or"46"
(indexed color) or"0;5;0"
(RGB components of an indexed color)- Returns:
- the IStyle for the specified converter
-
parse
Parses the specified comma-separated sequence of style descriptors and returns the associated styles. For each markup, strings starting with"bg("
are delegated tobg(String)
, others are delegated tobg(String)
.- Parameters:
commaSeparatedCodes
- one or more descriptors, e.g."bg(blue),underline,red"
- Returns:
- an array with all styles for the specified descriptors
-