-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolorama.sh
60 lines (49 loc) · 1.31 KB
/
colorama.sh
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
#!/bin/bash
array=(
"""
</> kesalahan $1
argumen tidak terdaftar
syntax $1 eror
"""
)
function bold {
if (( $? == 0 )); then
str=${1}
else
str=1
fi
case $1 in
hitam)setterm --foreground black --bold on ;;
merah)setterm --foreground red --bold on ;;
hijau)setterm --foreground green --bold on ;;
kuning)setterm --foreground yellow --bold on ;;
biru)setterm --foreground blue --bold on ;;
pink)setterm --foreground magenta --bold on ;;
cyan)setterm --foreground cyan --bold on ;;
putih)setterm --foreground white --bold on ;;
*)echo "${array[*]}"; exit 4
;;
esac
}
function normal {
if (( $? == 0 )); then
str=${1}
else
str=1
fi
case $1 in
hitam)setterm --foreground black --bold off ;;
merah)setterm --foreground red --bold off ;;
hijau)setterm --foreground green --bold off ;;
kuning)setterm --foreground yellow --bold off ;;
biru)setterm --foreground blue --bold off ;;
pink)setterm --foreground magenta --bold off ;;
cyan)setterm --foreground cyan --bold off ;;
putih)setterm --foreground white --bold off ;;
*)echo "${array[*]}"; exit 4
;;
esac
}
function stop {
setterm --foreground default
}