UNPKG

1.63 kBtext/coffeescriptView Raw
1
2TRM = require './main'
3rpr = ( require 'util' ).inspect
4log = console.log
5
6
7show_color_gamut = ->
8 _esc = "\x1b" # ESCape
9 _csi = _esc + "[" # Command Sequence Initializer
10 _sgr = "m" # Select Graphic Rendition
11 reset = _csi + "0" + _sgr
12
13 for green in [ 0 .. 5 ]
14 for blue in [ 0 .. 5 ]
15 R = []
16 for red in [ 0 .. 5 ]
17 color_code = red * 36 + green * 6 + blue + 16
18 R.push "#{red} #{green} #{blue} #{color_code} #{_csi}38;05;#{color_code}#{_sgr}██████#{reset}"
19 log R.join ' '
20 for color_nr in [ 232 .. 255 ]
21 log "#{_csi}38;05;#{color_nr}#{_sgr} #{color_nr}██████#{reset}"
22
23
24log rpr TRM.red 'helo world', ( TRM.olive 'abc' ), [ 1, 2, 3, ]
25log TRM.red 'helo world', ( TRM.olive 'abc' ), ( TRM.olive TRM.underline [ 1, 2, 3, ] ), 'ooops'
26
27
28# log "A", @constants[ 'red' ], "B", @constants[ 'reset' ], "C"
29# log "A", @constants[ 'red' ], "B", @constants[ 'olive' ], "C", @constants[ 'red' ], "C"
30
31# log @constants[ 'reset' ]
32
33
34# show_color_gamut()
35log "helo"
36process.stdout.write ( TRM.goto 10, 1 ) + 'ABCD'
37process.stdout.write ( TRM.right 5 ) + "X" + TRM.up( 3 ) + '---'
38process.stdout.write ( TRM.goto_column 50 ) + 'HERE'
39process.stdout.write ( TRM.move 2, 3 ) + 'THERE'
40process.stdout.write TRM.clear_above
41# process.stdout.write TRM.clear_to_bottom
42log TRM.underline 'lore', ( TRM.blue 'ipsum' ), 'dolores'
43log TRM.orange 'lore', ( TRM.green TRM.underline 'ipsum' ), 'dolores'
44process.stdout.write ( TRM.down 15 )
45show_color_gamut()
46log()
47log()
48log()