Class TerminalColors

java.lang.Object
org.ek9lang.compiler.common.TerminalColors

public final class TerminalColors extends Object
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)
  • Method Details

    • isColorsSupported

      public static boolean isColorsSupported()
    • isUnicodeSupported

      public static boolean isUnicodeSupported()
    • isEmojiSupported

      public static boolean isEmojiSupported()
    • errorSymbol

      public static String errorSymbol()
    • warningSymbol

      public static String warningSymbol()
    • infoSymbol

      public static String infoSymbol()
    • hintSymbol

      public static String hintSymbol()
    • linkSymbol

      public static String linkSymbol()
    • checkSymbol

      public static String checkSymbol()
    • fixSymbol

      public static String fixSymbol()
    • exampleSymbol

      public static String exampleSymbol()
    • pipe

      public static String pipe()
    • arrow

      public static String arrow()
    • corner

      public static String corner()
    • tee

      public static String tee()
    • horizontalLine

      public static String horizontalLine()
    • error

      public static String error(String text)
    • errorCaret

      public static String errorCaret(String text)
      Bright red for error carets (^^^^^) - more vivid than regular red.
    • warning

      public static String warning(String text)
    • warningCaret

      public static String warningCaret(String text)
      Bright yellow for warning carets (^^^^^) - more vivid than regular yellow.
    • info

      public static String info(String text)
    • hint

      public static String hint(String text)
    • code

      public static String code(String text)
    • dim

      public static String dim(String text)
    • bold

      public static String bold(String text)
    • white

      public static String white(String text)
    • errorHeader

      public static String errorHeader(String errorCode, String message)
      Format an error header like: ❌ error[E50001]: message
    • warningHeader

      public static String warningHeader(String warningCode, String message)
      Format a warning header like: ⚠️ warning[W01234]: message
    • location

      public static String location(String fileName, int line, int column)
      Format a location like: ──▶ file.ek9:15:12
    • sourceLine

      public static String sourceLine(int lineNumber, String source)
      Format a source line with line number.
    • carets

      public static String carets(int offset, int length, String message)
      Format error carets (^^^^^) under the error location.
    • hintLine

      public static String hintLine(String hintText)
      Format a hint line like: ├─ 💡 Did you mean: 'count'?
    • linkLine

      public static String linkLine(String url)
      Format a link line like: └─ 🔗 See: https://...
    • pipeLine

      public static String pipeLine()
      Format the pipe-only line for visual separation.
    • thickPipe

      public static String thickPipe()
      The thick vertical bar for blockquote-style boxes.
    • topCorner

      public static String topCorner()
      Top-left corner for heavy box drawing.
    • bottomCorner

      public static String bottomCorner()
      Bottom-left corner for heavy box drawing.
    • thickHorizontalLine

      public static String thickHorizontalLine()
      Heavy horizontal line for box drawing.
    • verboseBlock

      public static String verboseBlock(String text, String indent)
      Format a verbose explanation block with box corners. Uses heavy box-drawing characters to encapsulate the explanation.
      Parameters:
      text - The multi-line verbose explanation text
      indent - The base indentation before the border
      Returns:
      The formatted block with box borders