a9321128ae63bf038cf75add447c015ba3622c16
[sbp.git] / src / edu / berkeley / sbp / util / ANSI.java
1 // Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
2
3 package edu.berkeley.sbp.util;
4 public class ANSI {
5     private static final boolean disable =
6         !"true".equals(System.getProperty("sbp.color", "true"));
7     public static String black(Object o) { if (disable) return o+""; return o+""; }
8     public static String red(Object o) { if (disable) return o+""; return "\033[31m"+o+"\033[0m"; }
9     public static String green(Object o) { if (disable) return o+""; return "\033[32m"+o+"\033[0m"; }
10     public static String yellow(Object o) { if (disable) return o+""; return "\033[33m"+o+"\033[0m"; }
11     public static String blue(Object o) { if (disable) return o+""; return "\033[34m"+o+"\033[0m"; }
12     public static String purple(Object o) { if (disable) return o+""; return "\033[35m"+o+"\033[0m"; }
13     public static String cyan(Object o) { if (disable) return o+""; return "\033[36m"+o+"\033[0m"; }
14     public static String invert(Object o) { if (disable) return o+""; return "\033[7m"+o+"\033[0m"; }
15     public static String bold(Object o) { if (disable) return o+""; return "\033[1m"+o+"\033[0m"; }
16     public static String clreol() { return "\033[0K"; }
17 }