Skip to content

Instantly share code, notes, and snippets.

@SPIKEYPUP
Last active July 1, 2023 21:37
Show Gist options
  • Save SPIKEYPUP/ebfeab52e50a1beccbe65d83e634a114 to your computer and use it in GitHub Desktop.
Save SPIKEYPUP/ebfeab52e50a1beccbe65d83e634a114 to your computer and use it in GitHub Desktop.
Win10-Ansi Color For Prompt and More!
Credits: This is just a modification on the primary code for their prompt YT theme; made by hXR16F on their repo at github.com/hXR16F/hyperial
Elevated Blinking
$E[05m$E[40m$E[94m░▒▓$E[103m$E[34m$S$T$H$H$H$S-$E[31m$E[7m%username%$E[7m$E[36m$E[7m[@%computername%]$E[7m$E[0m$E[05m$E[40m$E[94m▓▒░$S$E[40m$E[31m░▒▓$E[41m$E[1;93m$S$P$S$E[40m$E[31m▓▒░$S$E[0m
Non-Elevated (No Blinking)
$E[40m$E[94m░▒▓$E[103m$E[34m$S$T$H$H$H$S-$E[31m$E[7m%username%$E[7m$E[36m$E[7m[@%computername%]$E[7m$E[0m$E[40m$E[94m▓▒░$S$E[40m$E[31m░▒▓$E[41m$E[1;93m$S$P$S$E[40m$E[31m▓▒░$S$E[0m
Usage:
Works with Windows "Cmd.exe /Command.com" prompt settings as well as with "Gsudo config Prompt".
1. Execute the change for the current session: prompt $E[05m$E[40m$E[94m░▒▓$E[103m$E[34m$S$T$H$H$H$S-$E[31m$E[7m%username%$E[7m$E[36m$E[7m[@%computername%]$E[7m$E[0m$E[05m$E[40m$E[94m▓▒░$S$E[40m$E[31m░▒▓$E[41m$E[1;93m$S$P$S$E[40m$E[31m▓▒░$S$E[0m
2. Set environment variable so the prompt is always set this way: setx prompt $E[05m$E[40m$E[94m░▒▓$E[103m$E[34m$S$T$H$H$H$S-$E[31m$E[7m%username%$E[7m$E[36m$E[7m[@%computername%]$E[7m$E[0m$E[05m$E[40m$E[94m▓▒░$S$E[40m$E[31m░▒▓$E[41m$E[1;93m$S$P$S$E[40m$E[31m▓▒░$S$E[0m
Reversal/Return to Defaults:
Simply enter: "Prompt $P$G" at the command prompt and this will enter you back to default state, if you used the "setx" command then use: "setx prompt $P$G"
Modification:
There are many possibilities, I suspect most are interested in the color and visual aspects and that's good because I don't know all the different variables etc. that can be used by "prompt" but i know it's more than I know.
Access the attached file under this gist called "w10ansicolor.cmd" run the raw in cmd.exe for the color/visuals chart and definitions.
@echo off
REM this file adapted from user @Mlocati on Github's gist with actual escapte chars embedded, this file here assumes
REM you are utilizing Win10 or another shell that understands ANSI codes with teh $E escape natively as well.
setlocal
cls
echo $E[101;93m STYLES $E[0m
echo $E[0m $E[0mReset$E[0m
echo $E[1m $E[1mBold$E[0m
echo $E[4m $E[4mUnderline$E[0m
echo $E[7m $E[7mInverse$E[0m
echo.
echo $E[101;93m NORMAL FOREGROUND COLORS $E[0m
echo $E[30m $E[30mBlack$E[0m (black)
echo $E[31m $E[31mRed$E[0m
echo $E[32m $E[32mGreen$E[0m
echo $E[33m $E[33mYellow$E[0m
echo $E[34m $E[34mBlue$E[0m
echo $E[35m $E[35mMagenta$E[0m
echo $E[36m $E[36mCyan$E[0m
echo $E[37m $E[37mWhite$E[0m
echo.
echo $E[101;93m NORMAL BACKGROUND COLORS $E[0m
echo $E[40m $E[40mBlack$E[0m
echo $E[41m $E[41mRed$E[0m
echo $E[42m $E[42mGreen$E[0m
echo $E[43m $E[43mYellow$E[0m
echo $E[44m $E[44mBlue$E[0m
echo $E[45m $E[45mMagenta$E[0m
echo $E[46m $E[46mCyan$E[0m
echo $E[47m $E[47mWhite$E[0m (white)
echo.
echo $E[101;93m STRONG FOREGROUND COLORS $E[0m
echo $E[90m $E[90mWhite$E[0m
echo $E[91m $E[91mRed$E[0m
echo $E[92m $E[92mGreen$E[0m
echo $E[93m $E[93mYellow$E[0m
echo $E[94m $E[94mBlue$E[0m
echo $E[95m $E[95mMagenta$E[0m
echo $E[96m $E[96mCyan$E[0m
echo $E[97m $E[97mWhite$E[0m
echo.
echo $E[101;93m STRONG BACKGROUND COLORS $E[0m
echo $E[100m $E[100mBlack$E[0m
echo $E[101m $E[101mRed$E[0m
echo $E[102m $E[102mGreen$E[0m
echo $E[103m $E[103mYellow$E[0m
echo $E[104m $E[104mBlue$E[0m
echo $E[105m $E[105mMagenta$E[0m
echo $E[106m $E[106mCyan$E[0m
echo $E[107m $E[107mWhite$E[0m
echo.
echo $E[101;93m COMBINATIONS $E[0m
echo $E[31m $E[31mred foreground color$E[0m
echo $E[7m $E[7minverse foreground ^<-^> background$E[0m
echo $E[7;31m $E[7;31minverse red foreground color$E[0m
echo $E[7m and nested $E[31m $E[7mbefore $E[31mnested$E[0m
echo $E[31m and nested $E[7m $E[31mbefore $E[7mnested$E[0m
pause
exit /B 0
@SPIKEYPUP
Copy link
Author

SPIKEYPUP commented Dec 1, 2020

Thanks again to @mlocati @hXR16F and @gerardog for doing the hard work :)

See this original gist that got me going on my quest to put some ownage on the prompt and many more excellent ones at: https://gist.github.com/mlocati/fdabcaeb8071d5c75a2d51712db24011

Thanks @mlocati! I am using this tool to help touchup a nice prompt template I found from (https://github.com/hXR16F/hyperialto) to do my own weirdo thing at https://gist.github.com/SPIKEYPUP/ebfeab52e50a1beccbe65d83e634a114#file-promptexamples-txt
since now on Windows Terminal we've been able to add elevated PS and CMD to the drop down using Gsudo (https://github.com/gerardog/gsudo) I can ensure that the prompts there are colorful and blink to make sure I know I'm acting as root/system and don't make a bad oopsie, I have a different background image set as well for the elevated shells and such but this really helps make sure I don't forget lol; and the color separation helps me see clearly where I'm at and what i'm doing etc. :D Thanks everyone for making it so easy to do things like this by sharing your work it really saves so much time and lets me learn a lot at the same time too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment