Created
December 12, 2021 09:32
-
-
Save ellemenno/710364a11292656985e0df6882c9146d to your computer and use it in GitHub Desktop.
ansi colortest for cmd and bash
This file contains 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
#!/usr/bin/env bash | |
# syntax : Esc[##;##m :: set bg;fg | |
# Esc[##m :: set one | |
# Esc[0m :: reset | |
# | |
# fg bg | |
# dark : Esc[3#m : Esc[4#m | |
# bright : Esc[9#m : Esc[10# | |
# | |
# # : 0 BLACK - bright black = dark grey | |
# # : 1 RED | |
# # : 2 GREEN | |
# # : 3 YELLOW | |
# # : 4 BLUE | |
# # : 5 MAGENTA | |
# # : 6 CYAN | |
# # : 7 WHITE - dark white = light grey | |
# | |
# adapted from https://gist.github.com/mlocati/fdabcaeb8071d5c75a2d51712db24011 | |
printf '\033c' # cls | |
echo -e "\033[40;93m STYLES \033[0m" | |
echo -e "Esc[0m \033[0mReset\033[0m" | |
echo -e "Esc[1m \033[1mBold\033[0m" | |
echo -e "Esc[4m \033[4mUnderline\033[0m" | |
echo -e "Esc[7m \033[7mInverse\033[0m" | |
echo | |
echo -e "\033[40;93m SPECTRUM \033[0m" | |
echo -e "\033[30m 30m \033[0m\033[90m 90m \033[0m\033[37m 37m \033[0m\033[97m 97m \033[0m" | |
echo -e "\033[40m 40m \033[0m\033[100m 100m \033[0m\033[47m 47m \033[0m\033[107m 107m \033[0m" | |
echo -e "\033[31m 31m \033[0m\033[33m 33m \033[0m\033[32m 32m \033[0m\033[36m 36m \033[0m\033[34m 34m \033[0m\033[35m 35m \033[0m" | |
echo -e "\033[91m 91m \033[0m\033[93m 93m \033[0m\033[92m 92m \033[0m\033[96m 96m \033[0m\033[94m 94m \033[0m\033[95m 95m \033[0m" | |
echo -e "\033[41m 41m \033[0m\033[43m 43m \033[0m\033[42m 42m \033[0m\033[46m 46m \033[0m\033[44m 44m \033[0m\033[45m 45m \033[0m" | |
echo -e "\033[101m 101m \033[0m\033[103m 103m \033[0m\033[102m 102m \033[0m\033[106m 106m \033[0m\033[104m 104m \033[0m\033[105m 105m \033[0m" | |
echo | |
echo -e "\033[40;93m FOREGROUND COLORS OVER DEFAULT BACKGROUND (DARK BLACK) \033[0m" | |
echo -e "Esc[30m \033[30mDark Black \033[0m | Esc[90m \033[90mBright Black \033[0m" | |
echo -e "Esc[31m \033[31mDark Red \033[0m | Esc[91m \033[91mBright Red \033[0m" | |
echo -e "Esc[32m \033[32mDark Green \033[0m | Esc[92m \033[92mBright Green \033[0m" | |
echo -e "Esc[33m \033[33mDark Yellow \033[0m | Esc[93m \033[93mBright Yellow \033[0m" | |
echo -e "Esc[34m \033[34mDark Blue \033[0m | Esc[94m \033[94mBright Blue \033[0m" | |
echo -e "Esc[35m \033[35mDark Magenta\033[0m | Esc[95m \033[95mBright Magenta\033[0m" | |
echo -e "Esc[36m \033[36mDark Cyan \033[0m | Esc[96m \033[96mBright Cyan \033[0m" | |
echo -e "Esc[37m \033[37mDark White \033[0m | Esc[97m \033[97mBright White \033[0m" | |
echo | |
echo -e "\033[40;93m BACKGROUND COLORS UNDER DEFAULT FOREGROUND (BRIGHT WHITE) \033[0m" | |
echo -e "Esc[40m \033[40mDark Black \033[0m | Esc[100m \033[100mBright Black \033[0m" | |
echo -e "Esc[41m \033[41mDark Red \033[0m | Esc[101m \033[101mBright Red \033[0m" | |
echo -e "Esc[42m \033[42mDark Green \033[0m | Esc[102m \033[102mBright Green \033[0m" | |
echo -e "Esc[43m \033[43mDark Yellow \033[0m | Esc[103m \033[103mBright Yellow \033[0m" | |
echo -e "Esc[44m \033[44mDark Blue \033[0m | Esc[104m \033[104mBright Blue \033[0m" | |
echo -e "Esc[45m \033[45mDark Magenta\033[0m | Esc[105m \033[105mBright Magenta\033[0m" | |
echo -e "Esc[46m \033[46mDark Cyan \033[0m | Esc[106m \033[106mBright Cyan \033[0m" | |
echo -e "Esc[47m \033[47mDark White \033[0m | Esc[107m \033[107mBright White \033[0m" | |
echo | |
echo -e "\033[40;93m COMBINATIONS \033[0m" | |
echo -e "Esc[7m | \033[7minvert foreground & background\033[0m" | |
echo -e "Esc[32m | \033[32mgreen foreground color\033[0m" | |
echo -e "Esc[7;32m | \033[7;32minverted green foreground color\033[0m" | |
echo -e "Esc[7m then Esc[32m | \033[7mstart inverted.. \033[32mthen add green\033[0m" | |
echo -e "Esc[32m then Esc[7m | \033[32mstart green.. \033[7mthen do inversion\033[0m" | |
echo |
This file contains 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
@echo off | |
rem syntax : Esc[##;##m :: set bg;fg | |
rem Esc[##m :: set one | |
rem Esc[0m :: reset | |
rem | |
rem fg bg | |
rem dark : Esc[3#m : Esc[4#m | |
rem bright : Esc[9#m : Esc[10#m | |
rem | |
rem # : 0 BLACK - bright black = dark grey | |
rem # : 1 RED | |
rem # : 2 GREEN | |
rem # : 3 YELLOW | |
rem # : 4 BLUE | |
rem # : 5 MAGENTA | |
rem # : 6 CYAN | |
rem # : 7 WHITE - dark white = light grey | |
rem | |
rem adapted from https://gist.github.com/mlocati/fdabcaeb8071d5c75a2d51712db24011 | |
setlocal | |
call :setESC | |
cls | |
echo %ESC%[40;93m STYLES %ESC%[0m | |
echo Esc[0m %ESC%[0mReset%ESC%[0m | |
echo Esc[1m %ESC%[1mBold%ESC%[0m | |
echo Esc[4m %ESC%[4mUnderline%ESC%[0m | |
echo Esc[7m %ESC%[7mInverse%ESC%[0m | |
echo. | |
echo %ESC%[40;93m SPECTRUM %ESC%[0m | |
echo %ESC%[30m 30m %ESC%[0m%ESC%[90m 90m %ESC%[0m%ESC%[37m 37m %ESC%[0m%ESC%[97m 97m %ESC%[0m | |
echo %ESC%[40m 40m %ESC%[0m%ESC%[100m 100m %ESC%[0m%ESC%[47m 47m %ESC%[0m%ESC%[107m 107m %ESC%[0m | |
echo %ESC%[31m 31m %ESC%[0m%ESC%[33m 33m %ESC%[0m%ESC%[32m 32m %ESC%[0m%ESC%[36m 36m %ESC%[0m%ESC%[34m 34m %ESC%[0m%ESC%[35m 35m %ESC%[0m | |
echo %ESC%[91m 91m %ESC%[0m%ESC%[93m 93m %ESC%[0m%ESC%[92m 92m %ESC%[0m%ESC%[96m 96m %ESC%[0m%ESC%[94m 94m %ESC%[0m%ESC%[95m 95m %ESC%[0m | |
echo %ESC%[41m 41m %ESC%[0m%ESC%[43m 43m %ESC%[0m%ESC%[42m 42m %ESC%[0m%ESC%[46m 46m %ESC%[0m%ESC%[44m 44m %ESC%[0m%ESC%[45m 45m %ESC%[0m | |
echo %ESC%[101m 101m %ESC%[0m%ESC%[103m 103m %ESC%[0m%ESC%[102m 102m %ESC%[0m%ESC%[106m 106m %ESC%[0m%ESC%[104m 104m %ESC%[0m%ESC%[105m 105m %ESC%[0m | |
echo. | |
echo %ESC%[40;93m FOREGROUND COLORS OVER DEFAULT BACKGROUND (DARK BLACK) %ESC%[0m | |
echo Esc[30m %ESC%[30mDark Black %ESC%[0m ^| Esc[90m %ESC%[90mBright Black %ESC%[0m | |
echo Esc[31m %ESC%[31mDark Red %ESC%[0m ^| Esc[91m %ESC%[91mBright Red %ESC%[0m | |
echo Esc[32m %ESC%[32mDark Green %ESC%[0m ^| Esc[92m %ESC%[92mBright Green %ESC%[0m | |
echo Esc[33m %ESC%[33mDark Yellow %ESC%[0m ^| Esc[93m %ESC%[93mBright Yellow %ESC%[0m | |
echo Esc[34m %ESC%[34mDark Blue %ESC%[0m ^| Esc[94m %ESC%[94mBright Blue %ESC%[0m | |
echo Esc[35m %ESC%[35mDark Magenta%ESC%[0m ^| Esc[95m %ESC%[95mBright Magenta%ESC%[0m | |
echo Esc[36m %ESC%[36mDark Cyan %ESC%[0m ^| Esc[96m %ESC%[96mBright Cyan %ESC%[0m | |
echo Esc[37m %ESC%[37mDark White %ESC%[0m ^| Esc[97m %ESC%[97mBright White %ESC%[0m | |
echo. | |
echo %ESC%[40;93m BACKGROUND COLORS UNDER DEFAULT FOREGROUND (BRIGHT WHITE) %ESC%[0m | |
echo Esc[40m %ESC%[40mDark Black %ESC%[0m ^| Esc[100m %ESC%[100mBright Black %ESC%[0m | |
echo Esc[41m %ESC%[41mDark Red %ESC%[0m ^| Esc[101m %ESC%[101mBright Red %ESC%[0m | |
echo Esc[42m %ESC%[42mDark Green %ESC%[0m ^| Esc[102m %ESC%[102mBright Green %ESC%[0m | |
echo Esc[43m %ESC%[43mDark Yellow %ESC%[0m ^| Esc[103m %ESC%[103mBright Yellow %ESC%[0m | |
echo Esc[44m %ESC%[44mDark Blue %ESC%[0m ^| Esc[104m %ESC%[104mBright Blue %ESC%[0m | |
echo Esc[45m %ESC%[45mDark Magenta%ESC%[0m ^| Esc[105m %ESC%[105mBright Magenta%ESC%[0m | |
echo Esc[46m %ESC%[46mDark Cyan %ESC%[0m ^| Esc[106m %ESC%[106mBright Cyan %ESC%[0m | |
echo Esc[47m %ESC%[47mDark White %ESC%[0m ^| Esc[107m %ESC%[107mBright White %ESC%[0m | |
echo. | |
echo %ESC%[40;93m COMBINATIONS %ESC%[0m | |
echo Esc[7m ^| %ESC%[7minvert foreground ^& background%ESC%[0m | |
echo Esc[32m ^| %ESC%[32mgreen foreground color%ESC%[0m | |
echo Esc[7;32m ^| %ESC%[7;32minverted green foreground color%ESC%[0m | |
echo Esc[7m then Esc[32m ^| %ESC%[7mstart inverted.. %ESC%[32mthen add green%ESC%[0m | |
echo Esc[32m then Esc[7m ^| %ESC%[32mstart green.. %ESC%[7mthen do inversion%ESC%[0m | |
:setESC | |
rem capture escape character programmatically | |
for /F %%a in ('"prompt $E$S & echo on & for %%b in (1) do rem"') do set "ESC=%%a" | |
exit /B |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output