File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,18 @@ import (
44 "fmt"
55 "github.com/fzdwx/infinite/color"
66 "github.com/fzdwx/infinite/style"
7+ "strconv"
78)
89
910func main () {
11+ for i := 1 ; i < 257 ; i ++ {
12+ if i % 20 == 1 {
13+ fmt .Println ()
14+ }
15+ fmt .Print (style .New ().Bg (color .New (i - 1 )).Render (pad (i - 1 )))
16+ }
17+ fmt .Println ()
18+
1019 fmt .Println (style .New ().Fg (color .Magenta ).Render ("Magenta" ))
1120 fmt .Println (style .New ().Fg (color .Red ).Render ("Red" ))
1221 fmt .Println (style .New ().Fg (color .LightBlue ).Render ("LightBlue" ))
@@ -23,8 +32,15 @@ func main() {
2332 fmt .Println (style .New ().Fg (color .Subtle ).Render ("Subtle" ))
2433 fmt .Println (style .New ().BorderStyle (style .DoubleBorder ()).Render ("hello world" ))
2534 fmt .Println (style .New ().Width (200 ).Center ().Render ("hello world" ))
35+ }
2636
27- for i := 0 ; i < 255 ; i ++ {
28- fmt .Println (style .New ().Fg (color .New (i )).Render (fmt .Sprintf ("%d hello world" , i )))
37+ func pad (i int ) string {
38+ if i < 10 {
39+ return strconv .Itoa (i ) + " "
2940 }
41+ if i < 100 {
42+ return strconv .Itoa (i ) + " "
43+ }
44+
45+ return strconv .Itoa (i )
3046}
You can’t perform that action at this time.
0 commit comments