Skip to content

Create your own Zsh/Bash terminal prompt from scratch and then give it some color, all from the command line

License

Notifications You must be signed in to change notification settings

kyletimmermans/shell-color-prompt-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Version 2.5 Zsh 5.8 Bash 5.1.8 Latest commit Latest Release Date kyletimmermans Twitter

Shell-Color-Prompt-Tool

Customize your Zsh/Bash terminal prompt, from what info you want it to display (Username, Hostname, Symbols, etc), to its Foreground and Background Colors! It's highly recommended you use brighter colors for extra pop!


Install:

curl -q -s -LJO "https://github.com/kyletimmermans/shell-color-prompt-tool/releases/download/latest/shell-color-prompt-tool.sh" && chmod +x shell-color-prompt-tool.sh

Sample Program Walkthrough

Sample Program Walkthrough

Resulting Prompt

Resulting Prompt


Program Flags

Flag Explanation
--comment-out Comment out older prompt lines in .zshrc/.bashrc e.g. PROMPT= / PS1= to help prevent conflicting prompt definitions
--light-mode Better color contrast for the color picker menu on white/light-colored terminal backgrounds
--omz Disables your 'Oh My Zsh' theme if you have one, which could get in the way of applying your new prompt
--no-extras Don't add automatic newline to start of prompt and space to end of prompt
-h/--help/-u/--usage Show usage/help menu
-v/--version Get program version

Usage Notes

  • You don't need to add a newline character at the beginning of your prompt for spacing between actual prompts, one will be added for you. Same with a space after the prompt so there's space between the prompt and inputted commands, one will automatically be added for you. This feature can be disabled with the --no-extras flag.

  • If you’re on Mac and want to use the --comment-out or --omz flags, you must have 'gawk' installed

  • For the actual prompt string in the .zshrc/.bashrc file, some text editors like Sublime Text will show the ANSI escape characters like "\e[0;30m" as "<0x1b>". Use a text editor like Vim to show the raw text.

  • Fullscreen terminals will be able to fit the spacing and styling of the interactive prompt the best

  • Colors may vary from system to system. When using the Custom RGB option, make sure your terminal supports TRUECOLOR (See here)


Reset Prompt Back to Default

Don't like the prompt that got saved and want to change it back to its default?
1. In your Terminal type: vi ~/.zshrc or vi ~/.bashrc
2. Hit 'i' on your keyboard to start editing the file and remove the line(s) at the bottom of the file, "export PROMPT=etc" (Zsh) or "export PS1=etc" (Bash), that has the comment above it "Added by Shell-Color-Prompt-Tool"
3. If you used --comment-out or --omz, uncomment your old prompt lines
4. Hit 'escape (esc)' on your keyboard and then type :wq and hit enter
5. Back in your Terminal now, type source ~/.zshrc or source ~/.bashrc and hit enter
6. Restart your Terminal
Good as new!

Changelog

v1.0: Initial-Relase
v1.1:
  -Fixed issue where symbol choices misaligned with actual symbol output, found by @christiankuhtz
  -Added period symbol to list of part choices
  -Added --version and -v command line flag
  -Fixed prompt spacing and wording
v2.0:
  -Support for Bash added so its been changed from "Zsh-Color-Prompt-Tool" to "Shell-Color-Prompt-Tool"
  -Added option to edit either a standard user prompt (PROMPT) or root prompt (RPROMPT), or both for Zsh
  -Any added line(s) will have the comment above it, "Added by Zsh Color Prompt Tool" so the user knows which prompts were generated by the program
  -Added --omz, --light-mode, --comment-out, and --no-extras flags
  -Added more symbols and colors to chose from in the menus
  -Added automatic newline to front of generated prompt and extra space to the end for cleaner prompt and terminal UX
  -Messing up a color no longer makes you redo the foreground and background color, just the one that was incorrect
  -Fixed issue where colors weren't properly escaped and could cause visual bugs
  -Added: -h/--help & -u/--usage flags
v2.5:
  -Added Custom RGB color option
  -Fixed error messsages showing incorrect range of color options
  -Updated and cleaned up help/usage flag output

About

Create your own Zsh/Bash terminal prompt from scratch and then give it some color, all from the command line

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages