From c5eef33dad0ffb145338039ba85345173b5a682e Mon Sep 17 00:00:00 2001 From: nojhan Date: Sun, 19 Feb 2023 09:20:28 +0100 Subject: [PATCH] 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. --- dotmatrix.theme | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/dotmatrix.theme b/dotmatrix.theme index f181683..c3a0991 100644 --- a/dotmatrix.theme +++ b/dotmatrix.theme @@ -493,18 +493,25 @@ _lp_dotmatrix_theme_prompt() { #################################################################### # IN LINE #################################################################### - - lp_terminal_format ${DOTMATRIX_COLOR_LINE[@]+"${DOTMATRIX_COLOR_LINE[@]}"} - - local inline_left="${NO_COL}$LP_PS1_PREFIX${lp_terminal_format}${DOTMATRIX_LINE}" + local color_line + if (( LP_ENABLE_SSH_COLORS )); then + local lp_hostname_hash + __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. local ista="$_LP_FIRST_INDEX" local imid=$((_LP_FIRST_INDEX+1)) local iend=$((_LP_FIRST_INDEX+2)) - local d="${DOTMATRIX_ITEMS[ista]}${DOTMATRIX_SPACE_LINE}" - local I="${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[imid]}${DOTMATRIX_SPACE_LINE}" - local b="${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[iend]}" + local d="${DOTMATRIX_ITEMS[ista]}${DOTMATRIX_SPACE_LINE}${NO_COL}" + local I="${color_line}${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[imid]}${DOTMATRIX_SPACE_LINE}${NO_COL}" + local b="${color_line}${DOTMATRIX_SPACE_LINE}${DOTMATRIX_ITEMS[iend]}" if _lp_software_collections ; then inline_left+="$d${lp_software_collections}$b" fi