File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,32 @@ Example
25
25
-------
26
26
27
27
``` js
28
+ var ac = require (' ansi-canvas' );
29
+
30
+ var canvas = ac ();
31
+ var context = canvas .getContext (' 2d' );
32
+
33
+ // draw a purple background
34
+ context .fillStyle = ' purple' ;
35
+ context .fillRect (0 , 0 , canvas .width , canvas .height );
36
+
37
+ // write some text
38
+ context .fillStyle = ' #00f' ;
39
+ context .font = ' italic 15px sans-serif' ;
40
+ context .textBaseline = ' top' ;
41
+ context .fillText (' Hello world!' , 1 , 1 );
42
+ context .font = ' bold 20px sans-serif' ;
43
+ context .strokeText (' Hello world!' , 1 , 21 );
44
+
45
+ // IMPORTANT!!!
46
+ // call `canvas.render()` when you're ready to flush the canvas to the terminal
47
+ canvas .render ();
28
48
```
29
49
50
+ Outputs something like:
51
+
52
+ ![ ] ( http://i.cloudup.com/5tGgXjcRWw.png )
53
+
30
54
31
55
License
32
56
-------
You can’t perform that action at this time.
0 commit comments