Skip to content

Commit b0ffb57

Browse files
committed
README++
1 parent 3d57491 commit b0ffb57

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,32 @@ Example
2525
-------
2626

2727
``` 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();
2848
```
2949

50+
Outputs something like:
51+
52+
![](http://i.cloudup.com/5tGgXjcRWw.png)
53+
3054

3155
License
3256
-------

0 commit comments

Comments
 (0)