|
| 1 | +import art from 'ascii-art'; |
| 2 | + |
| 3 | +art.font('test', 'doom').toPromise(); |
| 4 | + |
| 5 | +art.font('my text', 'Doom', (rendered: string) => { |
| 6 | + rendered.big(); |
| 7 | +}); |
| 8 | + |
| 9 | +art.font('my text', 'Doom', '', (rendered) => { |
| 10 | + rendered.big(); |
| 11 | +}); |
| 12 | + |
| 13 | +art.artwork({ |
| 14 | + artwork: 'textfiles.com/art/st-char.asc' |
| 15 | +}).lines(31, 45, function(rendered: string) { |
| 16 | + // cleanup non-unix terminators |
| 17 | + rendered = rendered.replace(/\r/g, ''); |
| 18 | + art.image({ |
| 19 | + filepath : '~/Images/earth_in_space.jpg', |
| 20 | + alphabet : 'ultra-wide' |
| 21 | + }).overlay(rendered, { |
| 22 | + x: 0, |
| 23 | + y: -1, |
| 24 | + style: 'red+blink', |
| 25 | + transparent: '&' |
| 26 | + }, function(_final: any) {}); |
| 27 | +}); |
| 28 | + |
| 29 | +art.font('Ghost Wire BBS', 'Doom', function(logo) { |
| 30 | + art.font('No place like home', 'rusted', function(subtext) { |
| 31 | + art.table({ |
| 32 | + verticalBar : ' ', |
| 33 | + horizontalBar : ' ', |
| 34 | + intersection : ' ', |
| 35 | + data: [ |
| 36 | + {name: art.style('current users', 'red'), value: '203'}, |
| 37 | + {name: 'operator', value: 'vince.vega'}, |
| 38 | + {name: 'dial-in', value: '(917)555-4202'}, |
| 39 | + ] |
| 40 | + }).lines(2, function(table: any) { |
| 41 | + art.image({ |
| 42 | + filepath : '~/Images/starburst_red.jpg', |
| 43 | + alphabet : 'ultra-wide' |
| 44 | + }).lines(2, 30).overlay(logo, { |
| 45 | + x: 0, |
| 46 | + y: 0, |
| 47 | + style: 'blue', |
| 48 | + }).overlay(subtext, { |
| 49 | + x: 19, |
| 50 | + y: 8, |
| 51 | + style: 'yellow', |
| 52 | + }).overlay(table, { |
| 53 | + x: -1, |
| 54 | + y: -1, |
| 55 | + style: 'green', |
| 56 | + }, function(_final: any) { |
| 57 | + }); |
| 58 | + }); |
| 59 | + }); |
| 60 | +}); |
| 61 | + |
| 62 | +art.image({ |
| 63 | + width : 40, |
| 64 | + filepath : '/Images/initech.png', |
| 65 | + alphabet : 'wide' |
| 66 | +}).font('INITECH', 'Doom', 'cyan', function(_ascii) { |
| 67 | +}); |
| 68 | + |
| 69 | +art.table({ |
| 70 | + data: [ |
| 71 | + {text: ' .\'ANDRE. '}, |
| 72 | + {text: ' ..THE.GIANT\'. '}, |
| 73 | + {text: '.With.Bobby."The.Brain"'}, |
| 74 | + {text: '.Heenan.'} |
| 75 | + ], |
| 76 | + verticalBar : ' ', |
| 77 | + horizontalBar : ' ', |
| 78 | + intersection : ' ' |
| 79 | +}).lines(2, function(table: any) { |
| 80 | + art.strings([ |
| 81 | + 'ANDRE', |
| 82 | + 'the', |
| 83 | + 'GIANT', |
| 84 | + 'POSSE', |
| 85 | + '7\'4"', |
| 86 | + '520 LB' |
| 87 | + ], 'rusted', function(andre: any, the: any, giant: any, posse: any, height: any, weight: any) { |
| 88 | + art.strings([ 'has', 'a'], 'twopoint', function(has: any, a: any) { |
| 89 | + art.image({ |
| 90 | + filepath : '/Images/andre_has_a_posse.jpeg', |
| 91 | + alphabet : 'ultra-wide' |
| 92 | + }).overlay(andre, { |
| 93 | + x: 8, y: 4, |
| 94 | + style: 'white' |
| 95 | + }).overlay(the, { |
| 96 | + x: 10, y: 7, |
| 97 | + style: 'white', |
| 98 | + transparent : true |
| 99 | + }).overlay(giant, { |
| 100 | + x: 8, y: 10, |
| 101 | + style: 'white', |
| 102 | + transparent : true |
| 103 | + }).overlay(has, { |
| 104 | + x: 10, y: 14, |
| 105 | + style: 'white' |
| 106 | + }).overlay(a, { |
| 107 | + x: 13, y: 17, |
| 108 | + style: 'white' |
| 109 | + }).overlay(posse, { |
| 110 | + x: 5, y: 20, |
| 111 | + style: 'bright_black', |
| 112 | + transparent: true |
| 113 | + }).overlay(height, { |
| 114 | + x: 59, y: 3, |
| 115 | + style: 'bright_black', |
| 116 | + transparent: true |
| 117 | + }).overlay(weight, { |
| 118 | + x: 59, y: 8, |
| 119 | + style: 'bright_black', |
| 120 | + transparent: true |
| 121 | + }).overlay(table, { |
| 122 | + x: 6, y: -6, |
| 123 | + style: 'bright_black', |
| 124 | + transparent: true |
| 125 | + }, function(_final: any) { |
| 126 | + }); |
| 127 | + }); |
| 128 | + }); |
| 129 | +}); |
| 130 | + |
| 131 | +art.Figlet.fontPath = 'Fonts'; |
| 132 | + |
| 133 | +const image = new art.Image({ |
| 134 | + filepath: '~/Images/metropolis.jpg', |
| 135 | + alphabet: 'variant4' |
| 136 | +}); |
| 137 | +image.write(function(_err: any, _rendered: string) { |
| 138 | +}); |
| 139 | + |
| 140 | +art.font('Prompt', 'Basic', 'red').font('v1', 'Doom', 'magenta', function(_rendered) { |
| 141 | +}); |
| 142 | + |
| 143 | +art.image({ |
| 144 | + width : 40, |
| 145 | + filepath : '/Images/initech.png', |
| 146 | + alphabet : 'wide' |
| 147 | +}).font('INITECH', 'Doom', 'cyan', function(_ascii) { |
| 148 | +}); |
| 149 | + |
| 150 | +art.style('my text', 'red+underline'); |
| 151 | + |
| 152 | +art.table({ |
| 153 | + width : 80, |
| 154 | + data : [ /* ... */ ], |
| 155 | + verticalBar : ' ', |
| 156 | + horizontalBar : ' ', |
| 157 | + intersection : ' ', |
| 158 | + columns : [ |
| 159 | + { |
| 160 | + value : 'Product', |
| 161 | + style : 'black+gray_bg' |
| 162 | + }, { |
| 163 | + value : 'Maker', |
| 164 | + style : 'white' |
| 165 | + }, { |
| 166 | + value : 'Location', |
| 167 | + style : 'white' |
| 168 | + } |
| 169 | + ] |
| 170 | +}, function(_rendered) { |
| 171 | + // use rendered text |
| 172 | +}); |
| 173 | + |
| 174 | +art.table({ |
| 175 | + width : 80, |
| 176 | + data : [ /* ... */ ], |
| 177 | + bars : { |
| 178 | + ul_corner: '┏', |
| 179 | + ur_corner: '┓', |
| 180 | + lr_corner: '┛', |
| 181 | + ll_corner: '┗', |
| 182 | + bottom_t: '┻', |
| 183 | + top_t: '┳', |
| 184 | + right_t: '┫', |
| 185 | + left_t: '┣', |
| 186 | + intersection: '╋', |
| 187 | + vertical: '┃', |
| 188 | + horizontal: '━', |
| 189 | + }, |
| 190 | + borderColor : 'bright_white', |
| 191 | +}, function(_rendered) { |
| 192 | + // use rendered text |
| 193 | +}); |
0 commit comments