Last active
March 11, 2022 08:49
-
-
Save kuanyui/55c73182943dd464f2edf2d8c0926b71 to your computer and use it in GitHub Desktop.
Colors in console (NodeJS, Makefile)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const C = { | |
Reset: "\x1b[0m", | |
Bright: "\x1b[1m", | |
Dim: "\x1b[2m", | |
Underscore: "\x1b[4m", | |
Blink: "\x1b[5m", | |
Reverse: "\x1b[7m", | |
Hidden: "\x1b[8m", | |
FgBlack: "\x1b[30m", | |
FgRed: "\x1b[31m", | |
FgGreen: "\x1b[32m", | |
FgYellow: "\x1b[33m", | |
FgBlue: "\x1b[34m", | |
FgMagenta: "\x1b[35m", | |
FgCyan: "\x1b[36m", | |
FgWhite: "\x1b[37m", | |
BgBlack: "\x1b[40m", | |
BgRed: "\x1b[41m", | |
BgGreen: "\x1b[42m", | |
BgYellow: "\x1b[43m", | |
BgBlue: "\x1b[44m", | |
BgMagenta: "\x1b[45m", | |
BgCyan: "\x1b[46m", | |
BgWhite: "\x1b[47m", | |
} as const |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifneq (,$(findstring xterm,${TERM})) | |
DARK_BLACK := $(shell tput setaf 0) | |
DARK_RED := $(shell tput setaf 1) | |
DARK_GREEN := $(shell tput setaf 2) | |
DARK_YELLOW := $(shell tput setaf 3) | |
DARK_BLUE := $(shell tput setaf 4) | |
DARK_MAGENTA := $(shell tput setaf 5) | |
DARK_CYAN := $(shell tput setaf 6) | |
DARK_WHITE := $(shell tput setaf 7) | |
BLACK := $(shell tput setaf 8) | |
RED := $(shell tput setaf 9) | |
GREEN := $(shell tput setaf 10) | |
YELLOW := $(shell tput setaf 11) | |
BLUE := $(shell tput setaf 12) | |
MAGENTA := $(shell tput setaf 13) | |
CYAN := $(shell tput setaf 14) | |
WHITE := $(shell tput setaf 15) | |
RESET := $(shell tput -Txterm sgr0) | |
else | |
DARK_BLACK := '' | |
DARK_RED := '' | |
DARK_GREEN := '' | |
DARK_YELLOW := '' | |
DARK_BLUE := '' | |
DARK_MAGENTA := '' | |
DARK_CYAN := '' | |
DARK_WHITE := '' | |
BLACK := '' | |
RED := '' | |
GREEN := '' | |
YELLOW := '' | |
BLUE := '' | |
MAGENTA := '' | |
CYAN := '' | |
WHITE := '' | |
RESET := '' | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Quoted from https://blog.gtwang.org/linux/how-to-make-a-fancy-and-useful-bash-prompt-in-linux-2/ :