From 2d20791d0d1b046562ae2f4cdb0537aba3e71549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Thu, 22 Dec 2016 10:18:04 +0100 Subject: [PATCH] Added 256 color code for hostname PS1 --- zsh/.zsh-custom/prompt_balkian_setup | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zsh/.zsh-custom/prompt_balkian_setup b/zsh/.zsh-custom/prompt_balkian_setup index 277db2b..4f3111d 100644 --- a/zsh/.zsh-custom/prompt_balkian_setup +++ b/zsh/.zsh-custom/prompt_balkian_setup @@ -21,7 +21,12 @@ _prompt_balkian_current_bg='NONE' _prompt_balkian_segment_separator=' ' _prompt_balkian_start_time=$SECONDS -hostnamecolor=$(hostname | od | tr ' ' '\n' | awk '{total = total + $1}END{print 30 + (total % 6)}') +#hostnamecolor=$(hostname | od | tr ' ' '\n' | awk '{total = total + $1}END{print 30 + (total % 6)}') +if [[ $TERM =~ "256color" ]]; then + hostnamecolor="$((16 + $(hostname | cksum | cut -c1-3) % 256))"; +else + hostnamecolor="$((31 + $(hostname | cksum | cut -c1-3) % 6))"; +fi function prompt_balkian_start_segment { local bg fg