diff options
| -rw-r--r-- | 11_Colors.zsh | 23 | ||||
| -rw-r--r-- | 12_Prompts.zsh | 2 | 
2 files changed, 19 insertions, 6 deletions
diff --git a/11_Colors.zsh b/11_Colors.zsh index 7cf4007..5b26c01 100644 --- a/11_Colors.zsh +++ b/11_Colors.zsh @@ -22,11 +22,24 @@ typeset -A prompt_colors git_colors mail_colors correct_colors battery_colors da  #  # I'm storing the resulting dominant color in $prompt_colors[generic] -PS1_ROOT=${PS1_ROOT:-$color[red]} -PS1_USER=${PS1_USER:-$color[blue]} -PS1_SUDO=${PS1_SUDO:-$color[green]} -PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} -PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} +if [ "$termcap[Co]" = "256" -o "$termcap[Co]" = "88" ] +then +	# We have a 256 colors term ! + +	local nb_colors=$(( 256 - 16 )) + +	PS1_ROOT=${PS1_ROOT:-38;5;$(( 16 + (36 * $SHLVL) % $nb_colors ))} +	PS1_USER=${PS1_USER:-38;5;$(( 16 + $SHLVL % $nb_colors ))} +	PS1_SUDO=${PS1_USER:-38;5;$(( 88 - $SHLVL % $nb_colors ))} +	PS1_USER_SSH=${PS1_USER_SSH:-38;5;$(( 88 - $SHLVL % $nb_colors ))} +	PS1_USER_SCR=${PS1_USER_SCR:-38;5;$(( 88 - $SHLVL % $nb_colors ))} +else +	PS1_ROOT=${PS1_ROOT:-$color[red]} +	PS1_USER=${PS1_USER:-$color[blue]} +	PS1_SUDO=${PS1_SUDO:-$color[green]} +	PS1_USER_SSH=${PS1_USER_SSH:-$color[magenta]} +	PS1_USER_SCR=${PS1_USER_SCR:-$color[cyan]} +fi  correct_colors[error]="$color[red];$color[bold]"  correct_colors[suggest]="$color[blue];$color[bold]" diff --git a/12_Prompts.zsh b/12_Prompts.zsh index 8aa70c6..bbb5e11 100644 --- a/12_Prompts.zsh +++ b/12_Prompts.zsh @@ -20,7 +20,7 @@ else  		# That's so good, use it ! :-)  		prompt_colors[generic]=${PS1_USER_SSH:-$PS1_USER}  	fi -	if ( [ "$TERM" = "screen" ] ) +	if ( echo "$TERM" | grep "^screen.*$" >/dev/null )  	then  		# Are we under a screen session ?  		prompt_colors[generic]=${PS1_USER_SCR:-$PS1_USER}  | 
