public String decorateString(String input, ANSIStyle... styles) {
    String decoratedInput = input;

    if (isAnsiEnabled()) {
      ANSIBuffer ansiBuffer = ANSIBuffer.getANSIBuffer();


      for (ANSIStyle ansiStyle : styles) {
        switch (ansiStyle) {
          case RED:
            ansiBuffer.red(input);
            break;
          case BLUE:
            ansiBuffer.blue(input);
            break;
          case GREEN:
            ansiBuffer.green(input);
            break;
          case BLACK:
            ansiBuffer.black(input);
            break;
          case YELLOW:
            ansiBuffer.yellow(input);
            break;
          case MAGENTA:
            ansiBuffer.magenta(input);
            break;
          case CYAN:
            ansiBuffer.cyan(input);
            break;
          case BOLD:
            ansiBuffer.bold(input);
            break;
          case UNDERSCORE:
            ansiBuffer.underscore(input);
            break;
          case BLINK:
            ansiBuffer.blink(input);
            break;
          case REVERSE:
            ansiBuffer.reverse(input);
            break;
          default:
            break;
        }
      }

      decoratedInput = ansiBuffer.toString();
    }

    return decoratedInput;
  }
Overrides jline.History to add History without newline characters.

@since GemFire 7.0
geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/shell/jline/ANSIHandler.java