forked from JesterOrNot/Gitpod-Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.nim
33 lines (33 loc) · 757 Bytes
/
test.nim
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
import std/[os, random, strutils, terminal]
randomize()
hideCursor()
var target, output: string
let color = rand(7)
case color:
of 1:
setForeGroundColor(fgGreen)
of 2:
setForeGroundColor(fgDefault)
of 3:
setForeGroundColor(fgMagenta)
of 4:
setForeGroundColor(fgCyan)
of 5:
setForeGroundColor(fgBlue)
of 6:
setForeGroundColor(fgYellow)
of 7:
setForeGroundColor(fgRed)
else:
setForeGroundColor(fgDefault)
target = "Hello World From Nim!"
output = spaces(target.len)
for i,x in target:
while x != output[i]:
output[i] = chr(rand(32..126))
eraseLine()
stdout.write(output)
stdout.flushFile()
sleep(3)
echo ""
showCursor()