mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
Per-host prompt colouring
Hashes the hostname to get a value 1-15 and uses that as the colour for the hostname in the prompt. Includes example theme (jms) which uses it
This commit is contained in:
parent
66a33b80c3
commit
788e1819d4
2 changed files with 56 additions and 0 deletions
|
|
@ -15,3 +15,17 @@ function take() {
|
|||
cd $1
|
||||
}
|
||||
|
||||
function string_hash() {
|
||||
HASHSTR=$1
|
||||
HASHSIZE=$2
|
||||
|
||||
HASHVAL=0
|
||||
for i in {1..${#HASHSTR}}; do;
|
||||
THISCHAR=$HASHSTR[$i]
|
||||
HASHVAL=$(( $HASHVAL + $((#THISCHAR)) ))
|
||||
done
|
||||
HASHSIZE=$(( $HASHSIZE - 1 ))
|
||||
HASHVAL=$(( $HASHVAL % $HASHSIZE ))
|
||||
HASHVAL=$(( $HASHVAL + 1 ))
|
||||
echo $HASHVAL
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue