feat(host): color the middle line with the host hash

If LP_ENABLE_SSH_COLORS, the the middle line will be colored with the host hash.
This commit is contained in:
Johann Dreo 2023-02-19 09:20:28 +01:00
commit c5eef33dad

View file

@ -493,18 +493,25 @@ _lp_dotmatrix_theme_prompt() {
#################################################################### ####################################################################
# IN LINE # IN LINE
#################################################################### ####################################################################
local color_line
lp_terminal_format ${DOTMATRIX_COLOR_LINE[@]+"${DOTMATRIX_COLOR_LINE[@]}"} if (( LP_ENABLE_SSH_COLORS )); then
local lp_hostname_hash
local inline_left="${NO_COL}$LP_PS1_PREFIX${lp_terminal_format}${DOTMATRIX_LINE}" __lp_hostname_hash
__lp_foreground_color "$(( 1 + lp_hostname_hash % 6 ))"
color_line="${_LP_OPEN_ESC}${af_color}${_LP_CLOSE_ESC}"
else
lp_terminal_format ${DOTMATRIX_COLOR_LINE[@]+"${DOTMATRIX_COLOR_LINE[@]}"}
color_line="$lp_terminal_format"
fi
local inline_left="${NO_COL}$LP_PS1_PREFIX${color_line}${DOTMATRIX_LINE}"
# Dev env section. # Dev env section.
local ista="$_LP_FIRST_INDEX" local ista="$_LP_FIRST_INDEX"
local imid=$((_LP_FIRST_INDEX+1)) local imid=$((_LP_FIRST_INDEX+1))
local iend=$((_LP_FIRST_INDEX+2)) local iend=$((_LP_FIRST_INDEX+2))
local d="${DOTMATRIX_ITEMS[ista]}${DOTMATRIX_SPACE_LINE}" local d="${DOTMATRIX_ITEMS[ista]}${DOTMATRIX_SPACE_LINE}${NO_COL}"
local I="${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[imid]}${DOTMATRIX_SPACE_LINE}" local I="${color_line}${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[imid]}${DOTMATRIX_SPACE_LINE}${NO_COL}"
local b="${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[iend]}" local b="${color_line}${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[iend]}"
if _lp_software_collections ; then if _lp_software_collections ; then
inline_left+="$d${lp_software_collections}$b" inline_left+="$d${lp_software_collections}$b"
fi fi