base prompt now supports 256 and 24 bit color
This commit is contained in:
@@ -2,5 +2,6 @@
|
||||
# ESPECIALLY DON'T EDIT this file if you're using zeesh near nuclear reactor
|
||||
# control software for whatever unimaginable reason.
|
||||
|
||||
_zeeshdev_ignore_updates=0
|
||||
_zeeshdev_ignore_updates=1
|
||||
_zeeshdev_ticker_newlines=0
|
||||
_zeeshdev_force_color_count=0
|
||||
@@ -6,25 +6,6 @@ fi
|
||||
|
||||
setopt prompt_subst
|
||||
|
||||
# color depth
|
||||
colordepth=4
|
||||
if [[ "$COLORTERM" == "truecolor" || "$COLORTERM" == "24bit" ]]; then
|
||||
colorcount=16000000
|
||||
else case $TERM in
|
||||
iterm |\
|
||||
vte* |\
|
||||
*-truecolor )
|
||||
export COLORTERM="truecolor" # environmental consistency
|
||||
colorcount=16000000
|
||||
;;
|
||||
*-256color )
|
||||
colorcount=256
|
||||
;;
|
||||
*)
|
||||
colorcount=$(tput colors | tr -d "\n")
|
||||
;;
|
||||
esac
|
||||
|
||||
kitty_available=n
|
||||
if (( ${+KITTY_SHELL_INTEGRATION} )); then
|
||||
kitty_available=y
|
||||
@@ -45,3 +26,29 @@ function ticker_message () {
|
||||
function ticker_finish () {
|
||||
[[ $_zeeshdev_ticker_newlines == 0 ]] && printf "\r${(l:$cols:: :)A}\r"
|
||||
}
|
||||
|
||||
# color depth
|
||||
colordepth=4
|
||||
if [[ $_zeeshdev_force_color_count -gt 0 ]]; then
|
||||
colorcount=$_zeeshdev_force_color_count
|
||||
ticker_message "zeesh: color count set to $colorcount (fuse blown)"
|
||||
elif [[ "$COLORTERM" == "truecolor" || "$COLORTERM" == "24bit" ]]; then
|
||||
ticker_message "zeesh: true color detected! (via COLORTERM)"
|
||||
colorcount=16000000
|
||||
else case $TERM in
|
||||
iterm |\
|
||||
vte* |\
|
||||
*-truecolor )
|
||||
export COLORTERM="truecolor" # environmental consistency
|
||||
ticker_message "zeesh: true color detected! (via TERM)"
|
||||
colorcount=16000000
|
||||
;;
|
||||
*-256color )
|
||||
ticker_message "256 colors detected (via TERM)"
|
||||
colorcount=256
|
||||
;;
|
||||
*)
|
||||
colorcount=$(tput colors | tr -d "\n")
|
||||
ticker_message "tput reports $colorcount colors"
|
||||
;;
|
||||
esac fi
|
||||
@@ -2,7 +2,20 @@
|
||||
# RPROMPT="%(?..%{$fg[red]%}%? )$RPROMPT"
|
||||
|
||||
function prompt_userathost () {
|
||||
print "%{$fg_bold[cyan]%}%n%{$fg_bold[white]%}@%{$fg_bold[magenta]%}%m %{$fg_bold[white]%}%~"
|
||||
if [[ $colorcount -gt 256 ]]; then
|
||||
fgcyan="%F{#5bcffa}"
|
||||
fgmagenta="%F{#f5abb9}"
|
||||
fgwhite="%F{#ffffff}"
|
||||
elif [[ $colorcount -eq 256 ]]; then
|
||||
fgcyan="\e[38;5;39m"
|
||||
fgmagenta="\e[38;5;210m"
|
||||
fgwhite="\e[38;5;255m"
|
||||
else
|
||||
fgcyan="$fg_bold[cyan]"
|
||||
fgmagenta="$fg_bold[magenta]"
|
||||
fgwhite="$fg_bold[white]"
|
||||
fi
|
||||
print "%{$fgcyan%}%n%{$fgwhite%}@%{$fgmagenta%}%m %{$fgwhite%}%~"
|
||||
}
|
||||
|
||||
prompt_functions+=prompt_userathost
|
||||
|
||||
Reference in New Issue
Block a user