-
Notifications
You must be signed in to change notification settings - Fork 1
/
erotic.go
43 lines (37 loc) · 1.15 KB
/
erotic.go
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
package eroticgo
import (
"fmt"
"strings"
)
const (
BLACK = COLOR("\033[1;30m%s\033[0m")
RED = COLOR("\033[1;31m%s\033[0m")
GREEN = COLOR("\033[1;32m%s\033[0m")
YELLOW = COLOR("\033[1;33m%s\033[0m")
BLUE = COLOR("\033[1;34m%s\033[0m")
MAGENTA = COLOR("\033[1;35m%s\033[0m")
CYAN = COLOR("\033[1;36m%s\033[0m")
WHITE = COLOR("\033[1;37m%s\033[0m")
)
type COLOR string
func (co COLOR) Sprint(args ...interface{}) string {
var messages = make([]string, 0, len(args))
for _, v := range args {
messages = append(messages, fmt.Sprint(v))
}
msg := strings.Join(messages, " ")
sps := strings.Split(msg, "\n")
newLines := make([]string, 0, len(sps))
for _, sub := range sps {
newLines = append(newLines, fmt.Sprintf(string(co), sub))
}
res := strings.Join(newLines, "\n")
return res
}
func (co COLOR) ShowMessage(msgs ...any) {
fmt.Println(co.Sprint("----------------------------------------"))
fmt.Println(co.Sprint("----------------------------------------"))
fmt.Println(co.Sprint(msgs...))
fmt.Println(co.Sprint("----------------------------------------"))
fmt.Println(co.Sprint("----------------------------------------"))
}