Class TerminalColors
java.lang.Object
org.ek9lang.compiler.common.TerminalColors
Terminal color and symbol support with automatic capability detection.
Provides ANSI escape codes for colors and Unicode symbols for enhanced error display.
Automatically detects terminal capabilities and falls back gracefully:
- Full: Colors + Emoji + Box-drawing (modern terminals)
- Unicode: Colors + Box-drawing, no emoji (some terminals)
- Basic: Colors only, ASCII symbols (older terminals)
- Plain: No colors, ASCII only (dumb terminals, redirected output)
THE terminal formatting functions. Hold an instance; every instance reads the ONE capability source of the
process (TerminalCapabilities.PROCESS), so two parts of one run never disagree about colour - a test that
forces a mode (TerminalCapabilities.forcePlainTextMode()) is seen by instances made before it too.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaiSymbol()arrow()Bottom-left corner for heavy box drawing.Format error carets (^^^^^) under the error location.corner()errorCaret(String text) Bright red for error carets (^^^^^) - more vivid than regular red.errorHeader(String errorCode, String message) Format an error header like: ❌ error[E50001]: messageFormat a hint line like: ├─ 💡 Did you mean: 'count'?booleanbooleanbooleanFormat a link line like: └─ 🔗 See: https://...Format a location like: ──▶ file.ek9:15:12pipe()pipeLine()Format the pipe-only line for visual separation.Format a rich explanation block with box corners.sourceLine(int lineNumber, String source) Format a source line with line number.tee()Heavy horizontal line for box drawing.The thick vertical bar for blockquote-style boxes.Top-left corner for heavy box drawing.warningCaret(String text) Bright yellow for warning carets (^^^^^) - more vivid than regular yellow.warningHeader(String warningCode, String message) Format a warning header like: ⚠️ warning[W01234]: message
-
Constructor Details
-
TerminalColors
public TerminalColors()
-
-
Method Details
-
isColorsSupported
public boolean isColorsSupported() -
isUnicodeSupported
public boolean isUnicodeSupported() -
isEmojiSupported
public boolean isEmojiSupported() -
errorSymbol
-
warningSymbol
-
infoSymbol
-
hintSymbol
-
linkSymbol
-
checkSymbol
-
fixSymbol
-
exampleSymbol
-
aiSymbol
-
pipe
-
arrow
-
corner
-
tee
-
horizontalLine
-
error
-
errorCaret
-
warning
-
warningCaret
-
info
-
hint
-
code
-
dim
-
bold
-
white
-
errorHeader
-
warningHeader
-
location
-
sourceLine
-
carets
-
hintLine
-
linkLine
-
pipeLine
Format the pipe-only line for visual separation. -
thickPipe
The thick vertical bar for blockquote-style boxes. -
topCorner
Top-left corner for heavy box drawing. -
bottomCorner
Bottom-left corner for heavy box drawing. -
thickHorizontalLine
Heavy horizontal line for box drawing. -
richBlock
Format a rich explanation block with box corners. Uses heavy box-drawing characters to encapsulate the explanation.- Parameters:
text- The multi-line rich explanation textindent- The base indentation before the border- Returns:
- The formatted block with box borders
-