add wolfi color schemed PS1 prompt

This commit is contained in:
Dustin Kirkland 2023-12-24 11:38:55 -06:00
parent f3ec913808
commit dab56999d5
2 changed files with 12 additions and 1 deletions

View file

@ -25,6 +25,9 @@ PKG="byobu"
PCT="%"
# Some shell(s) don't set the USER environment value (looking at you, ash)
[ -z "$USER" ] && export USER=$(whoami)
# Support two different backends (screen/tmux)
if [ -z "$BYOBU_BACKEND" ]; then
[ -r "/etc/byobu/backend" ] && . "/etc/byobu/backend"

View file

@ -1,5 +1,6 @@
# byobu's bashrc -- colorize the prompt
# Copyright (C) 2014 Dustin Kirkland
# Copyright (C) 2023 Dustin Kirkland
#
# Authors: Dustin Kirkland <kirkland@byobu.org>
#
@ -25,7 +26,7 @@ esac
if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
# Ensure that we're in bash, in a byobu environment
if [ -n "$BYOBU_BACKEND" ] && [ -n "$BASH" ]; then
byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e "$e "; }
byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e " $e "; }
[ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo)
byobu_prompt_symbol() {
if [ "$USER" = "root" ]; then
@ -52,6 +53,13 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
. "$BYOBU_RUN_DIR/dircolors"
fi
;;
"Wolfi")
# Use Wolfi colors (pink / purple / grey)
# For reference: https://upload.wikimedia.org/wikipedia/commons/1/15/Xterm_256color_chart.svg
# Convert hex to 256: https://gist.githubusercontent.com/MicahElliott/719710/raw/73d047f0a3ffc35f0655488547e7f24fa3f04ea6/colortrans.py
# Use Wolfi colors (pink=170 / purple=98 / blue=63); flashing error code on previous command non-zero exit
PS1="${debian_chroot:+($debian_chroot)}\[\e[03;5;15;54m\]\$(byobu_prompt_status)\[\e[00m\]\[\e[38;5;170m\]\u\[\e[00m\]@\[\e[38;5;98m\]\h\[\e[00m\]:\[\e[38;5;63m\]\w\[\e[00m\]\$(byobu_prompt_symbol) "
;;
*)
# Use Googley colors (blue / red / yellow / blue / green / red )
PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$(byobu_prompt_status)\[\e[38;5;69m\]\u\[\e[38;5;214m\]@\[\e[38;5;167m\]\h\[\e[38;5;214m\]:\[\e[38;5;71m\]\w\[\e[38;5;214m\]\$(byobu_prompt_symbol)\[\e[00m\] "