sqlline.ColorBuffer Maven / Gradle / Ivy
The newest version!
/*
// Licensed to Julian Hyde under one or more contributor license
// agreements. See the NOTICE file distributed with this work for
// additional information regarding copyright ownership.
//
// Julian Hyde licenses this file to you under the Modified BSD License
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at:
//
// http://opensource.org/licenses/BSD-3-Clause
*/
package sqlline;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
/**
* A buffer that can output segments using ANSI color.
*/
final class ColorBuffer implements Comparable {
/** Style attribute. */
enum ColorAttr {
BOLD("\033[1m"),
NORMAL("\033[m"),
REVERS("\033[7m"),
LINED("\033[4m"),
GREY("\033[1;30m"),
RED("\033[1;31m"),
GREEN("\033[1;32m"),
BLUE("\033[1;34m"),
CYAN("\033[1;36m"),
YELLOW("\033[1;33m"),
MAGENTA("\033[1;35m"),
INVISIBLE("\033[8m");
private final String style;
ColorAttr(String style) {
this.style = style;
}
@Override public String toString() {
return style;
}
}
private final List