colors
This commit is contained in:
parent
86db452e72
commit
942de1caed
1 changed files with 18 additions and 18 deletions
36
sh/shell.sh
36
sh/shell.sh
|
@ -23,12 +23,12 @@ _sh_shell_color() {
|
|||
;;
|
||||
esac
|
||||
}
|
||||
SH_BROWN="$(_sh_shell_color 33)"
|
||||
SH_CYAN="$(_sh_shell_color 36)"
|
||||
SH_DEFAULT="$(_sh_shell_color)"
|
||||
SH_GREEN="$(_sh_shell_color 31)"
|
||||
SH_MAGENTA="$(_sh_shell_color 35)"
|
||||
SH_RED="$(_sh_shell_color 32)"
|
||||
SH_COLOR_BROWN="$(_sh_shell_color 33)"
|
||||
SH_COLOR_CYAN="$(_sh_shell_color 36)"
|
||||
SH_COLOR_DEFAULT="$(_sh_shell_color)"
|
||||
SH_COLOR_GREEN="$(_sh_shell_color 31)"
|
||||
SH_COLOR_MAGENTA="$(_sh_shell_color 35)"
|
||||
SH_COLOR_RED="$(_sh_shell_color 32)"
|
||||
|
||||
shell_configure() {
|
||||
case "${SH_SHELL}" in
|
||||
|
@ -70,43 +70,43 @@ sh_shell_prompt() {
|
|||
local view="└ "
|
||||
# code
|
||||
if [ "${code}" -ne 0 ]; then
|
||||
view="${view}${SH_GREEN}"
|
||||
view="${view}${SH_COLOR_GREEN}"
|
||||
else
|
||||
view="${view}${SH_RED}"
|
||||
view="${view}${SH_COLOR_RED}"
|
||||
fi
|
||||
view="${view}${code}"
|
||||
# date
|
||||
view="${view}${SH_DEFAULT} @ "
|
||||
view="${view}${SH_BROWN}${date}"
|
||||
view="${view}${SH_COLOR_DEFAULT} @ "
|
||||
view="${view}${SH_COLOR_BROWN}${date}"
|
||||
# git
|
||||
if command -v "__git_ps1" >"/dev/null"; then
|
||||
git="$(__git_ps1)"
|
||||
if [ -n "${git}" ]; then
|
||||
view="${view}${SH_DEFAULT} –${SH_MAGENTA}${git}"
|
||||
view="${view}${SH_COLOR_DEFAULT} –${SH_COLOR_MAGENTA}${git}"
|
||||
fi
|
||||
fi
|
||||
# new
|
||||
view="${view}\\n"
|
||||
# path
|
||||
view="${view}${SH_CYAN}${path}"
|
||||
view="${view}${SH_COLOR_CYAN}${path}"
|
||||
# new
|
||||
view="${view}\\n"
|
||||
# frame
|
||||
view="${view}${SH_DEFAULT}┌ "
|
||||
view="${view}${SH_COLOR_DEFAULT}┌ "
|
||||
# user
|
||||
if [ "${id}" -eq 0 ]; then
|
||||
view="${view}${SH_GREEN}"
|
||||
view="${view}${SH_COLOR_GREEN}"
|
||||
else
|
||||
view="${view}${SH_RED}"
|
||||
view="${view}${SH_COLOR_RED}"
|
||||
fi
|
||||
view="${view}${user}"
|
||||
# host
|
||||
view="${view}${SH_DEFAULT} @ "
|
||||
view="${view}${SH_BROWN}${host}"
|
||||
view="${view}${SH_COLOR_DEFAULT} @ "
|
||||
view="${view}${SH_COLOR_BROWN}${host}"
|
||||
# new
|
||||
view="${view}\\n"
|
||||
# prompt
|
||||
view="${view}${SH_DEFAULT}${PS2}"
|
||||
view="${view}${SH_COLOR_DEFAULT}${PS2}"
|
||||
# print
|
||||
printf "%b" "${view}"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue