01: package org.incava.util;
02:
03: public class ANSI {
04: private static String ESC = new String(new byte[] { 27 });
05:
06: public static String makeColor(int n) {
07: return ESC + "[" + n + "m";
08: }
09:
10: public static String NONE = makeColor(0);
11: public static String RESET = makeColor(0);
12: public static String BOLD = makeColor(1);
13: public static String UNDERSCORE = makeColor(4);
14: public static String UNDERLINE = makeColor(4);
15: public static String BLINK = makeColor(5);
16: public static String REVERSE = makeColor(7);
17: public static String CONCEALED = makeColor(8);
18: public static String BLACK = makeColor(30);
19: public static String RED = makeColor(31);
20: public static String GREEN = makeColor(32);
21: public static String YELLOW = makeColor(33);
22: public static String BLUE = makeColor(34);
23: public static String MAGENTA = makeColor(35);
24: public static String CYAN = makeColor(36);
25: public static String WHITE = makeColor(37);
26: public static String ON_BLACK = makeColor(40);
27: public static String ON_RED = makeColor(41);
28: public static String ON_GREEN = makeColor(42);
29: public static String ON_YELLOW = makeColor(43);
30: public static String ON_BLUE = makeColor(44);
31: public static String ON_MAGENTA = makeColor(45);
32: public static String ON_CYAN = makeColor(46);
33: public static String ON_WHITE = makeColor(47);
34:
35: public static void main(String[] args) {
36: String ESC = new String(new byte[] { 27 });
37: System.out.println(ESC + "[34mblue" + ESC + "[0m");
38: System.out.println(BOLD + "bold" + RESET);
39: }
40:
41: }
|