ansi color codes chart code example
Example 1: ansi colors
public class ConsoleColors {
public static final String RESET = "\033[0m";
public static final String BLACK = "\033[0;30m";
public static final String RED = "\033[0;31m";
public static final String GREEN = "\033[0;32m";
public static final String YELLOW = "\033[0;33m";
public static final String BLUE = "\033[0;34m";
public static final String PURPLE = "\033[0;35m";
public static final String CYAN = "\033[0;36m";
public static final String WHITE = "\033[0;37m";
public static final String BLACK_BOLD = "\033[1;30m";
public static final String RED_BOLD = "\033[1;31m";
public static final String GREEN_BOLD = "\033[1;32m";
public static final String YELLOW_BOLD = "\033[1;33m";
public static final String BLUE_BOLD = "\033[1;34m";
public static final String PURPLE_BOLD = "\033[1;35m";
public static final String CYAN_BOLD = "\033[1;36m";
public static final String WHITE_BOLD = "\033[1;37m";
public static final String BLACK_UNDERLINED = "\033[4;30m";
public static final String RED_UNDERLINED = "\033[4;31m";
public static final String GREEN_UNDERLINED = "\033[4;32m";
public static final String YELLOW_UNDERLINED = "\033[4;33m";
public static final String BLUE_UNDERLINED = "\033[4;34m";
public static final String PURPLE_UNDERLINED = "\033[4;35m";
public static final String CYAN_UNDERLINED = "\033[4;36m";
public static final String WHITE_UNDERLINED = "\033[4;37m";
public static final String BLACK_BACKGROUND = "\033[40m";
public static final String RED_BACKGROUND = "\033[41m";
public static final String GREEN_BACKGROUND = "\033[42m";
public static final String YELLOW_BACKGROUND = "\033[43m";
public static final String BLUE_BACKGROUND = "\033[44m";
public static final String PURPLE_BACKGROUND = "\033[45m";
public static final String CYAN_BACKGROUND = "\033[46m";
public static final String WHITE_BACKGROUND = "\033[47m";
public static final String BLACK_BRIGHT = "\033[0;90m";
public static final String RED_BRIGHT = "\033[0;91m";
public static final String GREEN_BRIGHT = "\033[0;92m";
public static final String YELLOW_BRIGHT = "\033[0;93m";
public static final String BLUE_BRIGHT = "\033[0;94m";
public static final String PURPLE_BRIGHT = "\033[0;95m";
public static final String CYAN_BRIGHT = "\033[0;96m";
public static final String WHITE_BRIGHT = "\033[0;97m";
public static final String BLACK_BOLD_BRIGHT = "\033[1;90m";
public static final String RED_BOLD_BRIGHT = "\033[1;91m";
public static final String GREEN_BOLD_BRIGHT = "\033[1;92m";
public static final String YELLOW_BOLD_BRIGHT = "\033[1;93m";
public static final String BLUE_BOLD_BRIGHT = "\033[1;94m";
public static final String PURPLE_BOLD_BRIGHT = "\033[1;95m";
public static final String CYAN_BOLD_BRIGHT = "\033[1;96m";
public static final String WHITE_BOLD_BRIGHT = "\033[1;97m";
public static final String BLACK_BACKGROUND_BRIGHT = "\033[0;100m";
public static final String RED_BACKGROUND_BRIGHT = "\033[0;101m";
public static final String GREEN_BACKGROUND_BRIGHT = "\033[0;102m";
public static final String YELLOW_BACKGROUND_BRIGHT = "\033[0;103m";
public static final String BLUE_BACKGROUND_BRIGHT = "\033[0;104m";
public static final String PURPLE_BACKGROUND_BRIGHT = "\033[0;105m";
public static final String CYAN_BACKGROUND_BRIGHT = "\033[0;106m";
public static final String WHITE_BACKGROUND_BRIGHT = "\033[0;107m";
}
Example 2: ansi colors
Black \e[0;30m
Blue \e[0;34m
Green \e[0;32m
Cyan \e[0;36m
Red \e[0;31m
Purple \e[0;35m
Brown \e[0;33m
Gray \e[0;37m
Dark Gray \e[1;30m
Light Blue \e[1;34m
Light Green \e[1;32m
Light Cyan \e[1;36m
Light Red \e[1;31m
Light Purple \e[1;35m
Yellow \e[1;33m
White \e[1;37m
Example 3: python ansi escape sequences color collection
class colors:
reset = "\033[0m"
# Black
fgBlack = "\033[30m"
fgBrightBlack = "\033[30;1m"
bgBlack = "\033[40m"
bgBrightBlack = "\033[40;1m"
# Red
fgRed = "\033[31m"
fgBrightRed = "\033[31;1m"
bgRed = "\033[41m"
bgBrightRed = "\033[41;1m"
# Green
fgGreen = "\033[32m"
fgBrightGreen = "\033[32;1m"
bgGreen = "\033[42m"
bgBrightGreen = "\033[42;1m"
# Yellow
fgYellow = "\033[33m"
fgBrightYellow = "\033[33;1m"
bgYellow = "\033[43m"
bgBrightYellow = "\033[43;1m"
# Blue
fgBlue = "\033[34m"
fgBrightBlue = "\033[34;1m"
bgBlue = "\033[44m"
bgBrightBlue = "\033[44;1m"
# Magenta
fgMagenta = "\033[35m"
fgBrightMagenta = "\033[35;1m"
bgMagenta = "\033[45m"
bgBrightMagenta = "\033[45;1m"
# Cyan
fgCyan = "\033[36m"
fgBrightCyan = "\033[36;1m"
bgCyan = "\033[46m"
bgBrightCyan = "\033[46;1m"
# White
fgWhite = "\033[37m"
fgBrightWhite = "\033[37;1m"
bgWhite = "\033[47m"
bgBrightWhite = "\033[47;1m"