From 79f32e241d5391d1bd0284f56c2ba1cc753255d1 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Thu, 29 Apr 2021 01:05:25 +0200 Subject: [PATCH] Add handle for TTY prompt colors --- home/.config/sh/theme | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/home/.config/sh/theme b/home/.config/sh/theme index 73303c3..c598ff0 100755 --- a/home/.config/sh/theme +++ b/home/.config/sh/theme @@ -3,13 +3,25 @@ # hide EOL sign ('%') export PROMPT_EOL_MARK="" -# Color definition -GREEN="%F{047}" -RED="%F{196}" -ORANGE="%F{214}" -BLUE="%F{027}" -LBLUE="%F{075}" -PURPLE="%F{105}" +# TTY (pure linux) terminal only has 8-bit color support +# (unless you change it in kernel), respect this and downgrade +# the color scheme accordingly (it won't look best, but it's +# still better than no colors) +if [ $TERM = "linux" ]; then + GREEN="%F{002}" + RED="%F{001}" + ORANGE="%F{003}" + BLUE="%F{004}" + LBLUE="%F{006}" + PURPLE="%F{005}" +else + GREEN="%F{047}" + RED="%F{196}" + ORANGE="%F{214}" + BLUE="%F{027}" + LBLUE="%F{075}" + PURPLE="%F{105}" +fi RESET="%f" # Signals git status of CWD repository (if any)