public static String color()

in hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/terminal/impl/EscapeSequences.java [55:97]


  public static String color(Color foregroundColor, Color backgroundColor, boolean bold,
    boolean reverse, boolean blink, boolean underline) {

    int foregroundColorValue = getColorValue(foregroundColor, true);
    int backgroundColorValue = getColorValue(backgroundColor, false);

    StringBuilder sb = new StringBuilder();
    if (bold && reverse && blink && !underline) {
      sb.append("\033[0;1;7;5;");
    } else if (bold && reverse && !blink && !underline) {
      sb.append("\033[0;1;7;");
    } else if (!bold && reverse && blink && !underline) {
      sb.append("\033[0;7;5;");
    } else if (bold && !reverse && blink && !underline) {
      sb.append("\033[0;1;5;");
    } else if (bold && !reverse && !blink && !underline) {
      sb.append("\033[0;1;");
    } else if (!bold && reverse && !blink && !underline) {
      sb.append("\033[0;7;");
    } else if (!bold && !reverse && blink && !underline) {
      sb.append("\033[0;5;");
    } else if (bold && reverse && blink) {
      sb.append("\033[0;1;7;5;4;");
    } else if (bold && reverse) {
      sb.append("\033[0;1;7;4;");
    } else if (!bold && reverse && blink) {
      sb.append("\033[0;7;5;4;");
    } else if (bold && blink) {
      sb.append("\033[0;1;5;4;");
    } else if (bold) {
      sb.append("\033[0;1;4;");
    } else if (reverse) {
      sb.append("\033[0;7;4;");
    } else if (blink) {
      sb.append("\033[0;5;4;");
    } else if (underline) {
      sb.append("\033[0;4;");
    } else {
      sb.append("\033[0;");
    }
    sb.append(String.format("%d;%dm", foregroundColorValue, backgroundColorValue));
    return sb.toString();
  }