Package ortus.boxlang.runtime.cli
Class ColorPrint
java.lang.Object
ortus.boxlang.runtime.cli.ColorPrint
Fluent API for ANSI color printing with method chaining.
This class provides a dynamic and fluent approach to colored console output.
Colors can be specified by name or ANSI code (0-255), and styles can be chained.
Usage Examples:
\n * ColorPrint.color( "red" ).bold().print( "Error: " );\n * ColorPrint.color( "green" ).println( "Success!" );\n * ColorPrint.color( 196 ).background( "yellow" ).italic().print( "Custom colors" );\n * ColorPrint.red().bold().println( "Bold red text" );\n *"
-
Method Summary
Modifier and TypeMethodDescriptionstatic ColorPrintbackground(int ansiCode) Set background color by ANSI code (0-255).static ColorPrintbackground(String colorName) Set background color by name (instance method for chaining).static ColorPrintblack()static ColorPrintblue()static ColorPrintbold()---------------------------------------------------------------------------- Common Styles ----------------------------------------------------------------------------static ColorPrintstatic ColorPrintstatic ColorPrintstatic ColorPrintstatic ColorPrintstatic ColorPrintstatic ColorPrintstatic ColorPrintstatic ColorPrintcolor(int ansiCode) Set text color by ANSI code (0-255).static ColorPrintSet text color by name (instance method for chaining).static ColorPrintcyan()static ColorPrintdim()static ColorPrintgreen()static ColorPrintitalic()static ColorPrintmagenta()voidPrints text with the accumulated ANSI styles.voidPrints formatted text with the accumulated ANSI styles.voidPrints text with the accumulated ANSI styles and a newline.static ColorPrintred()---------------------------------------------------------------------------- Common Colors Entry Point ----------------------------------------------------------------------------static ColorPrintstatic ColorPrintCreate a ColorPrint instance for style-only operations.static ColorPrintstatic ColorPrintwhite()static ColorPrintyellow()
-
Method Details
-
red
---------------------------------------------------------------------------- Common Colors Entry Point ---------------------------------------------------------------------------- -
green
-
blue
-
yellow
-
magenta
-
cyan
-
white
-
black
-
brightRed
-
brightGreen
-
brightBlue
-
brightYellow
-
brightMagenta
-
brightCyan
-
brightWhite
-
brightBlack
-
color
Set text color by name (instance method for chaining).- Parameters:
colorName- The name of the color- Returns:
- A ColorPrint instance for method chaining
-
color
Set text color by ANSI code (0-255).- Parameters:
ansiCode- The ANSI color code (0-255)- Returns:
- A ColorPrint instance for method chaining
-
background
Set background color by name (instance method for chaining).- Parameters:
colorName- The name of the color- Returns:
- A ColorPrint instance for method chaining
-
background
Set background color by ANSI code (0-255).- Parameters:
ansiCode- The ANSI color code (0-255)- Returns:
- A ColorPrint instance for method chaining
-
style
Create a ColorPrint instance for style-only operations.- Returns:
- ColorPrint instance for method chaining
-
bold
---------------------------------------------------------------------------- Common Styles ---------------------------------------------------------------------------- -
italic
-
underline
-
dim
-
strikethrough
-
print
Prints text with the accumulated ANSI styles.- Parameters:
text- The text to print
-
println
Prints text with the accumulated ANSI styles and a newline.- Parameters:
text- The text to print
-
printf
Prints formatted text with the accumulated ANSI styles.- Parameters:
format- The format stringargs- Arguments referenced by the format specifiers in the format string
-