-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogo.go
More file actions
60 lines (51 loc) · 1.59 KB
/
logo.go
File metadata and controls
60 lines (51 loc) · 1.59 KB
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
package main
import "strings"
const (
ansiFrame = "\033[38;5;208m" // orange frame
ansiLens = "\033[90m" // black lens
ansiGlow = "\033[33m" // yellow-gold glow
ansiShine = "\033[93m" // bright yellow shine peak
ansiBridge = "\033[93m" // yellow bridge / arms
ansiReset = "\033[0m"
lensInner = 8 // ██ units inside each lens
shineCycle = lensInner + 4 // 4 blank frames between sweeps
)
// buildLogo returns the glasses logo with the shine at the given tick position.
func buildLogo(tick int) string {
arm := ansiBridge + "██"
bridge := ansiBridge + "████"
frame := ansiFrame + strings.Repeat("██", lensInner+2)
shineAt := tick % shineCycle
// top lens row: animated shine sweeps left → right
topRow := func() string {
if shineAt >= lensInner {
return ansiLens + strings.Repeat("██", lensInner)
}
var b strings.Builder
for i := 0; i < lensInner; i++ {
d := shineAt - i
if d < 0 {
d = -d
}
switch d {
case 0:
b.WriteString(ansiShine + "██")
case 1:
b.WriteString(ansiGlow + "██")
default:
b.WriteString(ansiLens + "██")
}
}
return b.String()
}
dark := ansiLens + strings.Repeat("██", lensInner)
lT := ansiFrame + "██" + topRow() + ansiFrame + "██"
lD := ansiFrame + "██" + dark + ansiFrame + "██"
return "\n" +
arm + frame + bridge + frame + arm + "\n" +
arm + lT + bridge + lT + arm + "\n" +
arm + lD + bridge + lD + arm + "\n" +
arm + lD + bridge + lD + arm + "\n" +
arm + frame + bridge + frame + arm + "\n" +
ansiReset + "\n"
}