From 37ed0a3a982f563eea673204b8379948d19be4d5 Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Tue, 10 Mar 2020 02:52:29 -0500 Subject: colors now exist for basic tty --- .config/fish/functions/fish_prompt.fish | 36 ++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/.config/fish/functions/fish_prompt.fish b/.config/fish/functions/fish_prompt.fish index 8a208e2..addf622 100755 --- a/.config/fish/functions/fish_prompt.fish +++ b/.config/fish/functions/fish_prompt.fish @@ -1,10 +1,26 @@ function fish_prompt --description 'Write out the prompt' + if test "$TERM" = "linux" + set error_color red + set good_color green + set path_color yellow + set user_color green + set host_color blue + set white_color white + else + set good_color f7ca88 + set error_color ab4642 + set path_color ba8baf + set user_color a1b56c + set host_color 7cafc2 + set white_color d8d8d8 + end + if set -l branch_name (command git symbolic-ref HEAD 2>/dev/null | string replace refs/heads/ '') - set git_info (set_color d8d8d8)"|" + set git_info (set_color $white_color)"|" if command git diff-index --quiet HEAD -- - set git_info $git_info(set_color f7ca88) + set git_info $git_info(set_color $good_color) else - set git_info $git_info(set_color ab4642) + set git_info $git_info(set_color $error_color) end set git_info $git_info"$branch_name" end @@ -13,12 +29,12 @@ function fish_prompt --description 'Write out the prompt' set -q fish_prompt_pwd_dir_length or set -lx fish_prompt_pwd_dir_length 0 - printf '%s' (set_color -o d8d8d8) '<' - printf '%s' (set_color a1b56c) $USER - printf '%s' (set_color d8d8d8) '@' - printf '%s' (set_color 7cafc2) (prompt_hostname) - printf '%s' (set_color d8d8d8) '|' - printf '%s' (set_color ba8baf) (prompt_pwd) + printf '%s' (set_color -o $white_color) '<' + printf '%s' (set_color $user_color) $USER + printf '%s' (set_color $white_color) '@' + printf '%s' (set_color $host_color) (prompt_hostname) + printf '%s' (set_color $white_color) '|' + printf '%s' (set_color $path_color) (prompt_pwd) printf '%s' $git_info - printf '%s' (set_color d8d8d8) '>' + printf '%s' (set_color $white_color) '>' end -- cgit v1.2.3