@@ -21,12 +21,125 @@ func subsection(_ title: String) {
2121 print ( title. bold. underline)
2222}
2323
24- // MARK: - Header
24+ // MARK: - Hero Banner
2525
26- print ( )
27- print ( ( " = " * 60 ) . lightCyan)
28- print ( " Rainbow Demo " . bold. lightCyan + " - Terminal Color Library for Swift " . lightCyan)
29- print ( ( " = " * 60 ) . lightCyan)
26+ func printHero( ) {
27+ print ( )
28+
29+ // ASCII Art "rainbow" - each letter in different color
30+ let r = [
31+ " ██████╗ " ,
32+ " ██╔══██╗ " ,
33+ " ██████╔╝ " ,
34+ " ██╔══██╗ " ,
35+ " ██║ ██║ " ,
36+ " ╚═╝ ╚═╝ "
37+ ]
38+ let a = [
39+ " █████╗ " ,
40+ " ██╔══██╗ " ,
41+ " ███████║ " ,
42+ " ██╔══██║ " ,
43+ " ██║ ██║ " ,
44+ " ╚═╝ ╚═╝ "
45+ ]
46+ let i = [
47+ " ██╗ " ,
48+ " ██║ " ,
49+ " ██║ " ,
50+ " ██║ " ,
51+ " ██║ " ,
52+ " ╚═╝ "
53+ ]
54+ let n = [
55+ " ███╗ ██╗ " ,
56+ " ████╗ ██║ " ,
57+ " ██╔██╗ ██║ " ,
58+ " ██║╚██╗██║ " ,
59+ " ██║ ╚████║ " ,
60+ " ╚═╝ ╚═══╝ "
61+ ]
62+ let b = [
63+ " ██████╗ " ,
64+ " ██╔══██╗ " ,
65+ " ██████╔╝ " ,
66+ " ██╔══██╗ " ,
67+ " ██████╔╝ " ,
68+ " ╚═════╝ "
69+ ]
70+ let o = [
71+ " ██████╗ " ,
72+ " ██╔═══██╗ " ,
73+ " ██║ ██║ " ,
74+ " ██║ ██║ " ,
75+ " ╚██████╔╝ " ,
76+ " ╚═════╝ "
77+ ]
78+ let w = [
79+ " ██╗ ██╗ " ,
80+ " ██║ ██║ " ,
81+ " ██║ █╗ ██║ " ,
82+ " ██║███╗██║ " ,
83+ " ╚███╔███╔╝ " ,
84+ " ╚══╝╚══╝ "
85+ ]
86+
87+ // Rainbow colors for each letter
88+ let colors : [ ( UInt8 , UInt8 , UInt8 ) ] = [
89+ ( 0 , 180 , 0 ) , // r - green
90+ ( 220 , 200 , 0 ) , // a - yellow
91+ ( 255 , 165 , 0 ) , // i - orange
92+ ( 255 , 50 , 50 ) , // n - red
93+ ( 255 , 0 , 150 ) , // b - magenta/pink
94+ ( 138 , 43 , 226 ) , // o - purple
95+ ( 0 , 191 , 255 ) // w - cyan/blue
96+ ]
97+
98+ let letters = [ r, a, i, n, b, o, w]
99+
100+ // Print the ASCII art
101+ for row in 0 ..< 6 {
102+ var line = " "
103+ for (letterIdx, letter) in letters. enumerated ( ) {
104+ let color = colors [ letterIdx]
105+ line += letter [ row] . bit24 ( color. 0 , color. 1 , color. 2 )
106+ }
107+ print ( line)
108+ }
109+
110+ // Tagline with smooth gradient: green -> yellow -> orange -> red -> purple -> blue
111+ print ( )
112+ let tagline = " Delightful console output for Swift developers "
113+
114+ // Create smooth gradient across the entire tagline
115+ let gradientColors : [ ( UInt8 , UInt8 , UInt8 ) ] = [
116+ ( 0 , 180 , 0 ) , // green
117+ ( 180 , 200 , 0 ) , // yellow-green
118+ ( 220 , 200 , 0 ) , // yellow
119+ ( 255 , 165 , 0 ) , // orange
120+ ( 255 , 100 , 50 ) , // red-orange
121+ ( 255 , 50 , 50 ) , // red
122+ ( 255 , 0 , 100 ) , // red-purple
123+ ( 200 , 0 , 180 ) , // purple
124+ ( 138 , 43 , 226 ) , // violet
125+ ( 80 , 80 , 255 ) , // blue-violet
126+ ( 0 , 150 , 255 ) , // blue
127+ ]
128+
129+ var coloredTagline = " "
130+ let taglineLength = tagline. count
131+ for (idx, char) in tagline. enumerated ( ) {
132+ // Map character position to gradient color
133+ let progress = Double ( idx) / Double( taglineLength - 1 )
134+ let colorIdx = Int ( progress * Double( gradientColors. count - 1 ) )
135+ let color = gradientColors [ min ( colorIdx, gradientColors. count - 1 ) ]
136+ coloredTagline += String ( char) . bit24 ( color. 0 , color. 1 , color. 2 )
137+ }
138+ print ( " " + coloredTagline)
139+ print ( )
140+ }
141+
142+ printHero ( )
30143
31144// MARK: - Basic Foreground Colors
32145
0 commit comments