Skip to content

Instantly share code, notes, and snippets.

@imshvc
Last active October 29, 2024 18:24
Show Gist options
  • Save imshvc/00d0e4844fd651e3fe4cf31c4dc50fbd to your computer and use it in GitHub Desktop.
Save imshvc/00d0e4844fd651e3fe4cf31c4dc50fbd to your computer and use it in GitHub Desktop.
Command Prompt Batch Colors
@echo off
rem -- console colors for batch scripts --
rem You can set these to empty variables
rem if you don't want colored output, or
rem set NO_COLOR env var to a non-empty
rem value
rem Control Codes
set CLR_RESET=
set CLR_BOLD=
set CLR_UNDERLINE=
set CLR_NEGATIVE=
set CLR_NOUNDERLINE=
set CLR_POSITIVE=
rem Colors (foreground)
set CLR_BLACK=
set CLR_RED=
set CLR_GREEN=
set CLR_YELLOW=
set CLR_BLUE=
set CLR_PURPLE=
set CLR_LBLUE=
set CLR_WHITE=
rem Colors (foreground, bright)
set CLR_BLACK2=
set CLR_RED2=
set CLR_GREEN2=
set CLR_YELLOW2=
set CLR_BLUE2=
set CLR_PURPLE2=
set CLR_LBLUE2=
set CLR_WHITE2=
rem Colors (background)
set CLR_BBLACK=
set CLR_BRED=
set CLR_BGREEN=
set CLR_BYELLOW=
set CLR_BBLUE=
set CLR_BPURPLE=
set CLR_BLBLUE=
set CLR_BWHITE=
rem Colors (background, bright)
set CLR_BBLACK2=
set CLR_BRED2=
set CLR_BGREEN2=
set CLR_BYELLOW2=
set CLR_BBLUE2=
set CLR_BPURPLE2=
set CLR_BLBLUE2=
set CLR_BWHITE2=
rem Colors for logging
set CLR_DEBUG=
set CLR_PASS=
set CLR_FAIL=
set CLR_WARN=
set CLR_INFO=
rem Disable colors if "NO_COLOR" variable set
rem See: https://no-color.org/
if "%NO_COLOR%" neq "" (
rem Control Codes
set CLR_RESET=
set CLR_BOLD=
set CLR_UNDERLINE=
set CLR_NEGATIVE=
set CLR_NOUNDERLINE=
set CLR_POSITIVE=
rem Colors (foreground)
set CLR_BLACK=
set CLR_RED=
set CLR_GREEN=
set CLR_YELLOW=
set CLR_BLUE=
set CLR_PURPLE=
set CLR_LBLUE=
set CLR_WHITE=
rem Colors (foreground, bright)
set CLR_BLACK2=
set CLR_RED2=
set CLR_GREEN2=
set CLR_YELLOW2=
set CLR_BLUE2=
set CLR_PURPLE2=
set CLR_LBLUE2=
set CLR_WHITE2=
rem Colors (background)
set CLR_BBLACK=
set CLR_BRED=
set CLR_BGREEN=
set CLR_BYELLOW=
set CLR_BBLUE=
set CLR_BPURPLE=
set CLR_BLBLUE=
set CLR_BWHITE=
rem Colors for logging
set CLR_DEBUG=
set CLR_PASS=
set CLR_FAIL=
set CLR_WARN=
set CLR_INFO=
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment