cc.neckbeard.utils.ANSI Maven / Gradle / Ivy
package cc.neckbeard.utils;
/**
* ANSI formatting codes
*
* SGR
* Code Effect Note
* 0 Reset / Normal All attributes off
* 1 Bold or increased intensity As with faint, the color change is a PC (SCO / CGA) invention.[28][better source needed]
* 2 Faint or decreased intensity aka Dim (with a saturated color). May be implemented as a light font weight like bold.[29]
* 3 Italic Not widely supported. Sometimes treated as inverse or blink.[28]
* 4 Underline Style extensions exist for Kitty, VTE, mintty and iTerm2.[30][31]
* 5 Slow Blink less than 150 per minute
* 6 Rapid Blink MS-DOS ANSI.SYS, 150+ per minute; not widely supported
* 7 Reverse video swap foreground and background colors, aka invert; inconsistent emulation[32]
* 8 Conceal aka Hide, not widely supported.
* 9 Crossed-out aka Strike, characters legible but marked as if for deletion.
* 10 Primary (default) font
* 11–19 Alternative font Select alternative font n − 10
* 20 Fraktur Rarely supported
* 21 Doubly underline or Bold off Double-underline per ECMA-48.[5]:8.3.117 See discussion
* 22 Normal color or intensity Neither bold nor faint
* 23 Not italic, not Fraktur
* 24 Underline off Not singly or doubly underlined
* 25 Blink off
* 26 Proportional spacing ITU T.61 and T.416, not known to be used on terminals
* 27 Reverse/invert off
* 28 Reveal conceal off
* 29 Not crossed out
* 30–37 Set foreground color See color table below
* 38 Set foreground color Next arguments are 5;n or 2;r;g;b, see below
* 39 Default foreground color implementation defined (according to standard)
* 40–47 Set background color See color table below
* 48 Set background color Next arguments are 5;n or 2;r;g;b, see below
* 49 Default background color implementation defined (according to standard)
* 50 Disable proportional spacing T.61 and T.416
* 51 Framed
* 52 Encircled Implemented as "emoji variation selector" in mintty.[33]
* 53 Overlined Implemented as "emoji variation selector" in mintty.[33]
* 54 Not framed or encircled
* 55 Not overlined
* 58 Set underline color Kitty, VTE, mintty, and iTerm2. (not in standard)[30][31] Next arguments are 5;n or 2;r;g;b, see below
* 59 Default underline color Kitty, VTE, mintty, and iTerm2. (not in standard)[30][31]
* 60 ideogram underline or right side line Rarely supported
* 61 ideogram double underline or double line on the right side Rarely supported
* 62 ideogram overline or left side line Rarely supported
* 63 ideogram double overline or double line on the left side Rarely supported
* 64 ideogram stress marking Rarely supported
* 65 ideogram attributes off reset the effects of all of 60–64
* 73 superscript mintty (not in standard)[33]
* 74 subscript mintty (not in standard)[33]
* 90–97 Set bright foreground color aixterm (not in standard)
* 100–107 Set bright background color aixterm (not in standard)
*
* COLORS
* Name FG BG
* Black 30 40
* Red 31 41
* Green 32 42
* Yellow 33 43
* Blue 34 44
* Magenta 35 45
* Cyan 36 46
* White 37 47
* Bright Black 90 100
* Bright Red 91 101
* Bright Green 92 102
* Bright Yellow 93 103
* Bright Blue 94 104
* Bright Magenta 95 105
* Bright Cyan 96 106
* Bright White 97 107
*/
public enum ANSI {
//Color end string, color reset
RESET("\033[0m"),
// Regular Colors. Normal color, no bold, background color etc.
BLACK("\033[0;30m"),
RED("\033[0;31m"),
GREEN("\033[0;32m"),
YELLOW("\033[0;33m"),
BLUE("\033[0;34m"),
MAGENTA("\033[0;35m"),
CYAN("\033[0;36m"),
WHITE("\033[0;37m"),
// Bold
BLACK_BOLD("\033[1;30m"),
RED_BOLD("\033[1;31m"),
GREEN_BOLD("\033[1;32m"),
YELLOW_BOLD("\033[1;33m"),
BLUE_BOLD("\033[1;34m"),
MAGENTA_BOLD("\033[1;35m"),
CYAN_BOLD("\033[1;36m"),
WHITE_BOLD("\033[1;37m"),
// Underline
BLACK_UNDERLINED("\033[4;30m"),
RED_UNDERLINED("\033[4;31m"),
GREEN_UNDERLINED("\033[4;32m"),
YELLOW_UNDERLINED("\033[4;33m"),
BLUE_UNDERLINED("\033[4;34m"),
MAGENTA_UNDERLINED("\033[4;35m"),
CYAN_UNDERLINED("\033[4;36m"),
WHITE_UNDERLINED("\033[4;37m"),
// Background
BLACK_BACKGROUND("\033[40m"),
RED_BACKGROUND("\033[41m"),
GREEN_BACKGROUND("\033[42m"),
YELLOW_BACKGROUND("\033[43m"),
BLUE_BACKGROUND("\033[44m"),
MAGENTA_BACKGROUND("\033[45m"),
CYAN_BACKGROUND("\033[46m"),
WHITE_BACKGROUND("\033[47m"),
// High Intensity
BLACK_BRIGHT("\033[0;90m"),
RED_BRIGHT("\033[0;91m"),
GREEN_BRIGHT("\033[0;92m"),
YELLOW_BRIGHT("\033[0;93m"),
BLUE_BRIGHT("\033[0;94m"),
MAGENTA_BRIGHT("\033[0;95m"),
CYAN_BRIGHT("\033[0;96m"),
WHITE_BRIGHT("\033[0;97m"),
// Bold High Intensity
BLACK_BOLD_BRIGHT("\033[1;90m"),
RED_BOLD_BRIGHT("\033[1;91m"),
GREEN_BOLD_BRIGHT("\033[1;92m"),
YELLOW_BOLD_BRIGHT("\033[1;93m"),
BLUE_BOLD_BRIGHT("\033[1;94m"),
MAGENTA_BOLD_BRIGHT("\033[1;95m"),
CYAN_BOLD_BRIGHT("\033[1;96m"),
WHITE_BOLD_BRIGHT("\033[1;97m"),
// High Intensity backgrounds
BLACK_BACKGROUND_BRIGHT("\033[0;100m"),
RED_BACKGROUND_BRIGHT("\033[0;101m"),
GREEN_BACKGROUND_BRIGHT("\033[0;102m"),
YELLOW_BACKGROUND_BRIGHT("\033[0;103m"),
BLUE_BACKGROUND_BRIGHT("\033[0;104m"),
MAGENTA_BACKGROUND_BRIGHT("\033[0;105m"),
CYAN_BACKGROUND_BRIGHT("\033[0;106m"),
WHITE_BACKGROUND_BRIGHT("\033[0;107m");
private final String code;
ANSI(String code) {
this.code = code;
}
@Override
public String toString() {
return code;
}
}