Class TerminalColorCapability.Builder

java.lang.Object
org.aesh.terminal.utils.TerminalColorCapability.Builder
Enclosing class:
TerminalColorCapability

public static class TerminalColorCapability.Builder extends Object
Builder for creating customized TerminalColorCapability instances.

The builder allows overriding the suggested color codes for semantic color types (error, success, warning, info, timestamp, message). Any color not explicitly set will use the theme-based default.

  • Constructor Details

    • Builder

      public Builder()
      Create a new empty Builder.
    • Builder

      public Builder(TerminalColorCapability base)
      Create a Builder initialized with values from an existing capability.
      Parameters:
      base - the capability to copy values from
  • Method Details

    • colorDepth

      public TerminalColorCapability.Builder colorDepth(ColorDepth colorDepth)
      Set the color depth capability.
      Parameters:
      colorDepth - the color depth
      Returns:
      this builder for method chaining
    • theme

      Set the terminal theme.
      Parameters:
      theme - the terminal theme
      Returns:
      this builder for method chaining
    • foregroundRGB

      public TerminalColorCapability.Builder foregroundRGB(int[] rgb)
      Set the foreground RGB color.
      Parameters:
      rgb - the RGB array [r, g, b] with values 0-255
      Returns:
      this builder for method chaining
    • backgroundRGB

      public TerminalColorCapability.Builder backgroundRGB(int[] rgb)
      Set the background RGB color.
      Parameters:
      rgb - the RGB array [r, g, b] with values 0-255
      Returns:
      this builder for method chaining
    • cursorRGB

      public TerminalColorCapability.Builder cursorRGB(int[] rgb)
      Set the cursor RGB color.
      Parameters:
      rgb - the RGB array [r, g, b] with values 0-255
      Returns:
      this builder for method chaining
    • paletteColors

      public TerminalColorCapability.Builder paletteColors(Map<Integer,int[]> colors)
      Set the palette colors.
      Parameters:
      colors - map of palette index to RGB array
      Returns:
      this builder for method chaining
    • paletteColor

      public TerminalColorCapability.Builder paletteColor(int index, int[] rgb)
      Add a single palette color.
      Parameters:
      index - the palette index (0-255)
      rgb - the RGB array [r, g, b] with values 0-255
      Returns:
      this builder for method chaining
    • foregroundCode

      public TerminalColorCapability.Builder foregroundCode(int code)
      Override the suggested foreground color code.
      Parameters:
      code - the ANSI color code to use for normal foreground text
      Returns:
      this builder for method chaining
    • errorCode

      public TerminalColorCapability.Builder errorCode(int code)
      Override the suggested error color code.

      Common values:

      • 31: dark red (good for light backgrounds)
      • 91: bright red (good for dark backgrounds)
      • 196: 256-color bright red
      Parameters:
      code - the ANSI color code to use for error messages
      Returns:
      this builder for method chaining
    • successCode

      public TerminalColorCapability.Builder successCode(int code)
      Override the suggested success color code.

      Common values:

      • 32: dark green (good for light backgrounds)
      • 92: bright green (good for dark backgrounds)
      • 46: 256-color bright green
      Parameters:
      code - the ANSI color code to use for success messages
      Returns:
      this builder for method chaining
    • warningCode

      public TerminalColorCapability.Builder warningCode(int code)
      Override the suggested warning color code.

      Common values:

      • 33: dark yellow/orange (good for light backgrounds)
      • 93: bright yellow (good for dark backgrounds)
      • 208: 256-color orange
      Parameters:
      code - the ANSI color code to use for warning messages
      Returns:
      this builder for method chaining
    • infoCode

      public TerminalColorCapability.Builder infoCode(int code)
      Override the suggested info color code.

      Common values:

      • 34: dark blue (good for light backgrounds)
      • 94: bright blue (good for dark backgrounds)
      • 75: 256-color light blue
      Parameters:
      code - the ANSI color code to use for info messages
      Returns:
      this builder for method chaining
    • debugCode

      public TerminalColorCapability.Builder debugCode(int code)
      Override the suggested debug color code.

      Common values:

      • 37: white (good for dark backgrounds)
      • 90: bright black/gray (subdued, good for both)
      • 244: 256-color gray
      Parameters:
      code - the ANSI color code to use for debug messages
      Returns:
      this builder for method chaining
    • traceCode

      public TerminalColorCapability.Builder traceCode(int code)
      Override the suggested trace color code.

      Common values:

      • 90: bright black/gray (default, very subdued)
      • 240: 256-color dark gray
      Parameters:
      code - the ANSI color code to use for trace messages
      Returns:
      this builder for method chaining
    • timestampCode

      public TerminalColorCapability.Builder timestampCode(int code)
      Override the suggested timestamp color code.

      Common values:

      • 36: dark cyan (good for light backgrounds)
      • 96: bright cyan (good for dark backgrounds)
      • 244: 256-color gray (subdued)
      Parameters:
      code - the ANSI color code to use for timestamps
      Returns:
      this builder for method chaining
    • messageCode

      public TerminalColorCapability.Builder messageCode(int code)
      Override the suggested message color code.

      Common values:

      • 35: dark magenta (good for light backgrounds)
      • 95: bright magenta (good for dark backgrounds)
      • 255: 256-color white
      Parameters:
      code - the ANSI color code to use for highlighted messages
      Returns:
      this builder for method chaining
    • categoryCode

      public TerminalColorCapability.Builder categoryCode(int code)
      Override the suggested category (package/class name) color code.

      Common values:

      • 34: dark blue (good for light backgrounds)
      • 94: bright blue (good for dark backgrounds)
      • 75: 256-color light blue
      Parameters:
      code - the ANSI color code to use for category/logger names
      Returns:
      this builder for method chaining
    • threadNameCode

      public TerminalColorCapability.Builder threadNameCode(int code)
      Override the suggested thread name color code.

      Common values:

      • 32: dark green (good for light backgrounds)
      • 92: bright green (good for dark backgrounds)
      • 78: 256-color muted green
      Parameters:
      code - the ANSI color code to use for thread names
      Returns:
      this builder for method chaining
    • fatalCode

      public TerminalColorCapability.Builder fatalCode(int code)
      Override the suggested fatal color code.

      Common values:

      • 31: dark red (good for light backgrounds)
      • 91: bright red (good for dark backgrounds)
      • 196: 256-color bright red
      Parameters:
      code - the ANSI color code to use for fatal messages
      Returns:
      this builder for method chaining
    • build

      public TerminalColorCapability build()
      Build the TerminalColorCapability with the configured values.
      Returns:
      a new TerminalColorCapability instance