aboutsummaryrefslogtreecommitdiff
path: root/internal/net/welcome.go
blob: ed606a24e72ce42ab5d7af5ac755ce3cdb49be67 (plain)
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
package net

import (
	"strings"

	"thehouseoficarus/internal/color"
)

func artColor(r rune) string {
	switch r {
	case '@':
		return color.FgCode("ansi", 4)
	case '!', ':', '.':
		return color.StyleCode("dim") + color.FgCode("ansi", 4)
	case ',':
		return color.FgCode("ansi", 5)
	case '*':
		return color.FgCode("ansi", 5)
	case '+', '|', '-':
		return color.FgCode("ansi", 3)
	}
	return ""
}

func colorizeRunes(s string) string {
	var sb strings.Builder
	current := ""
	for _, r := range s {
		want := artColor(r)
		if want != current {
			if current != "" {
				sb.WriteString(color.Reset)
			}
			if want != "" {
				sb.WriteString(want)
			}
			current = want
		}
		sb.WriteRune(r)
	}
	if current != "" {
		sb.WriteString(color.Reset)
	}
	return sb.String()
}

func colorizeArt(art string) string {
	welcomeText := "welcome to the house of icarus"
	before, after, found := strings.Cut(art, welcomeText)
	if found {
		return colorizeRunes(before) + color.FgCode("ansi", 7) + welcomeText + color.Reset + colorizeRunes(after)
	}
	return colorizeRunes(art)
}

func WelcomeBanner() string {
	return colorizeArt(`
                                                                   |        *    
       *                                   +                      -+-            
                          .                          ,             |             
.              ,                                           .              ,      
                                    *                                            
  @@@@@@@ @@@  @@@ @@@@@@@@      @@@  @@@  @@@@@@  @@@  @@@  @@@@@@ @@@@@@@@    +
    @@!   @@!  @@@ @@!      +    @@!  @@@ @@!  @@@ @@!  @@@ !@@     @@!          
    @!!   @!@!@!@! @!!!:!        @!@!@!@! @!@  !@! @!@  !@!  !@@!!  @!!!:!    *  
    !!:   !!:  !!! !!:        .  !!:  !!! !!:  !!! !!:  !!!     :!; !!:          
     :     :   : : : :: :::       :   : :  : :. :   :.:: :  ::.: :  : :: :::    .
   .                                                               +             
           *          welcome to the house of icarus       ,                 ,   
  ,    .                                                                         
            @@@@@@  @@@@@@@@      @@@  @@@@@@@  @@@@@@  @@@@@@@  @@@  @@@  @@@@@@
           @@!  @@@ @@!       ,   @@! !@@      @@!  @@@ @@!  @@@ @@!  @@@ !@@    
    |      @!@  !@! @!!!:!        !!@ @!@      @!@!@!@! @!@!!@!  @!@  !@!  !@@!! 
   -+-     !!:  !!! !!:           !!: :!!      !!:  !!! !!: :!!  !!:  !!!     :! 
    |       : :. :   :     .      :    :: :: :  :   : :  :   : :  :.:: :  ::.: : 
         ,                                                                       
   .          +                 ,                                     .          
                       .                               ,                         
      *                                     .                  ,              *  
                                   +                                             
`)
}