Class ColorPrint

java.lang.Object
ortus.boxlang.runtime.cli.ColorPrint

public class ColorPrint extends Object
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 Details

    • red

      public static ColorPrint red()
      ---------------------------------------------------------------------------- Common Colors Entry Point ----------------------------------------------------------------------------
    • green

      public static ColorPrint green()
    • blue

      public static ColorPrint blue()
    • yellow

      public static ColorPrint yellow()
    • magenta

      public static ColorPrint magenta()
    • cyan

      public static ColorPrint cyan()
    • white

      public static ColorPrint white()
    • black

      public static ColorPrint black()
    • brightRed

      public static ColorPrint brightRed()
    • brightGreen

      public static ColorPrint brightGreen()
    • brightBlue

      public static ColorPrint brightBlue()
    • brightYellow

      public static ColorPrint brightYellow()
    • brightMagenta

      public static ColorPrint brightMagenta()
    • brightCyan

      public static ColorPrint brightCyan()
    • brightWhite

      public static ColorPrint brightWhite()
    • brightBlack

      public static ColorPrint brightBlack()
    • color

      public static ColorPrint color(String colorName)
      Set text color by name (instance method for chaining).
      Parameters:
      colorName - The name of the color
      Returns:
      A ColorPrint instance for method chaining
    • color

      public static ColorPrint color(int ansiCode)
      Set text color by ANSI code (0-255).
      Parameters:
      ansiCode - The ANSI color code (0-255)
      Returns:
      A ColorPrint instance for method chaining
    • background

      public static ColorPrint background(String colorName)
      Set background color by name (instance method for chaining).
      Parameters:
      colorName - The name of the color
      Returns:
      A ColorPrint instance for method chaining
    • background

      public static ColorPrint background(int ansiCode)
      Set background color by ANSI code (0-255).
      Parameters:
      ansiCode - The ANSI color code (0-255)
      Returns:
      A ColorPrint instance for method chaining
    • style

      public static ColorPrint style(String style)
      Create a ColorPrint instance for style-only operations.
      Returns:
      ColorPrint instance for method chaining
    • bold

      public static ColorPrint bold()
      ---------------------------------------------------------------------------- Common Styles ----------------------------------------------------------------------------
    • italic

      public static ColorPrint italic()
    • underline

      public static ColorPrint underline()
    • dim

      public static ColorPrint dim()
    • strikethrough

      public static ColorPrint strikethrough()
    • print

      public void print(String text)
      Prints text with the accumulated ANSI styles.
      Parameters:
      text - The text to print
    • println

      public void println(String text)
      Prints text with the accumulated ANSI styles and a newline.
      Parameters:
      text - The text to print
    • printf

      public void printf(String format, Object... args)
      Prints formatted text with the accumulated ANSI styles.
      Parameters:
      format - The format string
      args - Arguments referenced by the format specifiers in the format string