Skip to content

Instantly share code, notes, and snippets.

@coseos
Created May 27, 2022 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coseos/68e15a0362cfcf16176fe7686dc7df4f to your computer and use it in GitHub Desktop.
Save coseos/68e15a0362cfcf16176fe7686dc7df4f to your computer and use it in GitHub Desktop.
Colorprompt provides a prompt with color
# colorprompt a prompt with color
function colorprompt() {
bo="\[\033[01;38;5;247m\]["
bc="\[\033[01;38;5;247m\]]"
u1="\[\033[01;38;5;196m\]${USER:0:1}"
u2="\[\033[01;38;5;009m\]${USER:1:1}"
u3="\[\033[01;38;5;202m\]${USER:2:1}"
u4="\[\033[01;38;5;208m\]${USER:3:1}"
u5="\[\033[01;38;5;214m\]${USER:4:1}"
u6="\[\033[01;38;5;220m\]${USER:5:1}"
u7="\[\033[01;38;5;226m\]${USER:6}"
at="\[\033[01;38;5;033m\]@"
host="\[\033[01;38;5;039m\]"
prompt="\[\033[01;38;5;040m\]"
local __colorprompt="$bo $u1$u2$u3$u4$u5$u6$u7 $at $host\h \w $bc $prompt\$ "
export PS1="$__colorprompt"
}
colorprompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment