Package org.aesh.terminal.utils
Class TerminalColorCapability.Builder
java.lang.Object
org.aesh.terminal.utils.TerminalColorCapability.Builder
- Enclosing class:
TerminalColorCapability
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 Summary
ConstructorsConstructorDescriptionBuilder()Create a new empty Builder.Create a Builder initialized with values from an existing capability. -
Method Summary
Modifier and TypeMethodDescriptionbackgroundRGB(int[] rgb) Set the background RGB color.build()Build the TerminalColorCapability with the configured values.categoryCode(int code) Override the suggested category (package/class name) color code.colorDepth(ColorDepth colorDepth) Set the color depth capability.cursorRGB(int[] rgb) Set the cursor RGB color.debugCode(int code) Override the suggested debug color code.errorCode(int code) Override the suggested error color code.fatalCode(int code) Override the suggested fatal color code.foregroundCode(int code) Override the suggested foreground color code.foregroundRGB(int[] rgb) Set the foreground RGB color.infoCode(int code) Override the suggested info color code.messageCode(int code) Override the suggested message color code.paletteColor(int index, int[] rgb) Add a single palette color.paletteColors(Map<Integer, int[]> colors) Set the palette colors.successCode(int code) Override the suggested success color code.theme(TerminalTheme theme) Set the terminal theme.threadNameCode(int code) Override the suggested thread name color code.timestampCode(int code) Override the suggested timestamp color code.traceCode(int code) Override the suggested trace color code.warningCode(int code) Override the suggested warning color code.
-
Constructor Details
-
Builder
public Builder()Create a new empty Builder. -
Builder
Create a Builder initialized with values from an existing capability.- Parameters:
base- the capability to copy values from
-
-
Method Details
-
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
Set the foreground RGB color.- Parameters:
rgb- the RGB array [r, g, b] with values 0-255- Returns:
- this builder for method chaining
-
backgroundRGB
Set the background RGB color.- Parameters:
rgb- the RGB array [r, g, b] with values 0-255- Returns:
- this builder for method chaining
-
cursorRGB
Set the cursor RGB color.- Parameters:
rgb- the RGB array [r, g, b] with values 0-255- Returns:
- this builder for method chaining
-
paletteColors
Set the palette colors.- Parameters:
colors- map of palette index to RGB array- Returns:
- this builder for method chaining
-
paletteColor
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
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
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
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
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
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
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
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
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
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
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
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
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
Build the TerminalColorCapability with the configured values.- Returns:
- a new TerminalColorCapability instance
-