change color of prompt slightly, especially color of pwd to more pleasing cyan and use AI to simply- and beautify the prompt-code
This commit is contained in:
parent
75876a1bd2
commit
d24877e683
49
.bashrc
49
.bashrc
|
|
@ -75,28 +75,41 @@ parse_git_branch() {
|
||||||
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
||||||
}
|
}
|
||||||
|
|
||||||
# set a fancy prompt
|
## set a fancy prompt
|
||||||
if [ $UID == 0 ]; then
|
# --- 1. Color-Definitions (256-Colors) ---
|
||||||
# root: red
|
# Format: \[ \033[38;5;COLOR_IDm \] ('m' marks the end of the code)
|
||||||
#PS_COLOR="\[\033[1;31m\]"
|
|
||||||
export PS1="\t \[$(tput bold)\]\[$(tput sgr0)\]\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[$(tput sgr0)\]\[\033[38;5;7m\]@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;1m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\$(parse_git_branch)\[\033[00m\]\n\\$ \[$(tput sgr0)\]"
|
# Reset standard text
|
||||||
|
F_RESET="\[\033[00m\]"
|
||||||
|
|
||||||
|
# Colors for user
|
||||||
|
U_USER="\[\033[38;5;3m\]" # Gelb/Orange
|
||||||
|
U_PWD="\[\033[38;5;39m\]" # Angenehmes Himmelblau (hier ändern!)
|
||||||
|
|
||||||
|
# Colors for Root
|
||||||
|
R_USER="\[\033[1;31m\]" # Fett, Rot (wichtig!)
|
||||||
|
R_PWD="\[\033[38;5;203m\]" # Sanfteres Lachsrosa (hier ändern!)
|
||||||
|
|
||||||
|
# Common colors
|
||||||
|
C_HOST="\[\033[38;5;7m\]" # Hellgrau
|
||||||
|
C_GIT="\[\033[38;5;15m\]" # Weiß
|
||||||
|
C_CHAR="\[\033[38;5;15m\]" # Weiß (für Doppelpunkt)
|
||||||
|
|
||||||
|
|
||||||
|
# --- 2. Logic and Prompt-Composition ---
|
||||||
|
if [ "$UID" -eq 0 ]; then
|
||||||
|
# --- ROOT PROMPT ---
|
||||||
|
# Structure: Time [RootColor]User [Normal]@[Host] : [RootPath]Path [Git] \n #
|
||||||
|
export PS1="\t ${R_USER}\u${C_HOST}@\h${C_CHAR}:${R_PWD}\w${C_GIT}\$(parse_git_branch)$F_RESET\n# "
|
||||||
else
|
else
|
||||||
# user
|
# --- USER PROMPT ---
|
||||||
#PS_COLOR="\[\033[33m\]"
|
# Structure: Time [UserFarbe]User [Normal]@[Host] : [PathFarbe]Path [Git] \n $
|
||||||
export PS1="\t \[$(tput sgr0)\]\[\033[38;5;3m\]\u\[$(tput sgr0)\]\[\033[38;5;7m\]@\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;87m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]\$(parse_git_branch)\[\033[00m\]\n\\$ \[$(tput sgr0)\]"
|
export PS1="\t ${U_USER}\u${C_HOST}@\h${C_CHAR}:${U_PWD}\w${C_GIT}\$(parse_git_branch)$F_RESET\n\\$ "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#PS1="\t ${PS_COLOR}${debian_chroot:+($debian_chroot)}\u@\h:\w\$ "
|
# Cleanup (for the variables not to stau 'exported')
|
||||||
#export PS1="\t \[$(tput sgr0)\]\[\033[38;5;11m\]\u\[$(tput sgr0)\]${PS_COLOR}@\h:\[$(tput sgr0)\]\[\033[38;5;87m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\] \n\\$ \[$(tput sgr0)\]"
|
unset F_RESET U_USER U_PWD R_USER R_PWD C_HOST C_GIT C_CHAR
|
||||||
|
|
||||||
# if this is an xterm modify the title
|
|
||||||
case $TERM in
|
|
||||||
xterm*)
|
|
||||||
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME} $(date +%H:%M:%S) [${PWD}]\007"'
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# define your own aliases in ~/.bash_aliases
|
# define your own aliases in ~/.bash_aliases
|
||||||
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
|
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user