-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_colors
116 lines (96 loc) · 2.95 KB
/
.bash_colors
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#! /bin/bash
# load git prompt
source ~/.git_prompt.sh
# load git completion
source ~/.git_completion.sh
# load error codes
source ~/.bash_errcodes
# set bef = '<'\!'>'
export GIT_REF="sh -c 'git describe --all 2> /dev/null' | sed 's|\([^/]*\)/\([^.]*\).*|(\2)|'"
###################### colors
# for dark backgrounds
#PS_COLOR_DATETIME='38;5;66'
#PS_COLOR_VENV='38;5;66'
#PS_COLOR_USER='38;5;169'
#PS_COLOR_HOST='38;5;169'
#PS_COLOR_CURRDIR='38;5;12'
#PS_COLOR_GIT='38;5;172'
# for light backgrounds
#PS_COLOR_DATETIME='38;5;245'
#PS_COLOR_VENV='38;5;245'
#PS_COLOR_USER='38;5;23'
#PS_COLOR_HOST='38;5;23'
#PS_COLOR_CURRDIR='38;5;32'
#PS_COLOR_GIT='38;5;208'
# for light backgrounds
#PS_COLOR_DATETIME='38;5;30'
#PS_COLOR_VENV='38;5;30'
#PS_COLOR_USER='38;5;161'
#PS_COLOR_HOST='38;5;172'
#PS_COLOR_CURRDIR='38;5;32'
#PS_COLOR_GIT='38;5;105'
# colorful personal preferences
#PS_COLOR_VENV='38;5;16'
#PS_COLOR_DATETIME='38;5;245'
#PS_COLOR_USER='38;5;126'
#PS_COLOR_HOST='38;5;106'
#PS_COLOR_CURRDIR='38;5;12'
#PS_COLOR_GIT='38;5;136'
# simple personal preferences
PS_COLOR_VENV='38;5;126'
PS_COLOR_DATETIME='38;5;245'
PS_COLOR_USER='38;5;161'
PS_COLOR_HOST='38;5;161'
PS_COLOR_CURRDIR='38;5;30'
PS_COLOR_GIT='38;5;105'
PS_COLOR_DARK='38;5;245'
PS_COLOR_RED='38;5;160'
PS_COLOR_GREEN='38;5;28'
PROMPT_COMMAND=__prompt_command
__prompt_command() {
# get exitcode
local EXIT="$?"
# get python virtualenv context
if test -z "$VIRTUAL_ENV" ; then
PYTHON_VIRTUALENV=""
else
PYTHON_VIRTUALENV="[`basename \"$VIRTUAL_ENV\"`]"
fi
PS_PRE='\[\e[1m\e['
PS_POS='m\]'
PS_ENDCOLOR='\[\e[m\]'
PS_NEWLINE='\n'
PS_USER='\u'
PS_HOST='\h'
PS_DATETIME='[\D{%d.%m.%y} - \t]'
PS_CURRDIR='\w'
PS_GIT='$(__git_ps1 "(%s)")'
PS1=${PS_PRE}${PS_COLOR_VENV}${PS_POS}${PYTHON_VIRTUALENV}' '${PS_ENDCOLOR}
PS1+=${PS_NEWLINE}
PS1+=${PS_PRE}${PS_COLOR_DATETIME}${PS_POS}${PS_DATETIME}' '${PS_ENDCOLOR}
PS1+=${PS_PRE}${PS_COLOR_USER}${PS_POS}${PS_USER}${PS_ENDCOLOR}
PS1+=${PS_PRE}${PS_COLOR_DARK}${PS_POS}'@'${PS_ENDCOLOR}
PS1+=${PS_PRE}${PS_COLOR_HOST}${PS_POS}${PS_HOST}${PS_ENDCOLOR}
PS1+=${PS_PRE}${PS_COLOR_DARK}${PS_POS}': '${PS_ENDCOLOR}
PS1+=${PS_PRE}${PS_COLOR_CURRDIR}${PS_POS}${PS_CURRDIR}' '${PS_ENDCOLOR}
if git --version &>/dev/null;
then
PS1+=${PS_PRE}${PS_COLOR_GIT}${PS_POS}${PS_GIT}' '${PS_ENDCOLOR}
else
PS1+=''
fi
PS1+=${PS_NEWLINE}
if [ $EXIT != 0 ]; then
PS1+=${PS_PRE}${PS_COLOR_RED}${PS_POS}${ERRCODES[${EXIT}]}${PS_ENDCOLOR}${PS_NEWLINE}
PS1+=${PS_PRE}${PS_COLOR_RED}${PS_POS}${EXIT}${PS_ENDCOLOR}
else
PS1+=${PS_PRE}${PS_COLOR_GREEN}${PS_POS}${EXIT}${PS_ENDCOLOR}
fi
PS1+=${PS_PRE}${PS_COLOR_DARK}${PS_POS}' >> '${PS_ENDCOLOR}
}
# set your terminal background to #dddddd and foreground to #222222
# for terminator in ~/.config/terminator/config
# for xterm in ~/.Xresources
# for night mode do
# xterm -rv
# xrdb ~/.Xresources