ansi-canvas
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -28,4 +28,3 @@ var tc = require('../'); | ||
function init() { | ||
canvas = tc({ small: true }); | ||
//canvas = tc(); | ||
canvas = tc(); | ||
ctx = canvas.getContext("2d"); | ||
@@ -32,0 +31,0 @@ return setInterval(draw, 1000 / 60); |
@@ -6,3 +6,3 @@ | ||
// create terminal <canvas> | ||
var canvas = tc({ small: true }); | ||
var canvas = tc(); | ||
var ctx = canvas.getContext('2d'); | ||
@@ -9,0 +9,0 @@ |
@@ -5,3 +5,3 @@ | ||
// create terminal <canvas> | ||
var canvas = tc({ small: true }); | ||
var canvas = tc(); | ||
var ctx = canvas.getContext('2d'); | ||
@@ -8,0 +8,0 @@ |
@@ -0,1 +1,9 @@ | ||
0.0.2 / 2013-06-11 | ||
================== | ||
- examples: add clock.js example | ||
- README.md improvements | ||
- make "small" mode enabled by default | ||
- clear the foreground and background before the flush | ||
0.0.1 / 2013-06-11 | ||
@@ -2,0 +10,0 @@ ================== |
@@ -26,3 +26,3 @@ | ||
var stream = opts.stream || process.stdout; | ||
var small = !!opts.small; | ||
var small = null == opts.small ? true : !!opts.small; | ||
var pixelHeight = small ? 0.5 : 1; | ||
@@ -154,3 +154,6 @@ var pixelWidth = small ? 1 : 2; | ||
cursor.fg.reset(); | ||
cursor.bg.reset(); | ||
cursor.flush(); | ||
} |
{ | ||
"name": "ansi-canvas", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Render a <canvas> node to your terminal", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,5 +5,11 @@ ansi-canvas | ||
![](http://i.cloudup.com/HAFymb_oa1.png) | ||
![](http://i.cloudup.com/xRdnRVg8zz.png) | ||
This module provides a `<canvas>` object backed by [node-canvas][], with its | ||
`width` and `height` properties automatically set to the proper size of the | ||
terminal window. | ||
The result is that you can use the [HTML Canvas API][canvas api] to render | ||
directly to your terminal. | ||
Installation | ||
@@ -23,5 +29,29 @@ ------------ | ||
``` js | ||
var ac = require('ansi-canvas'); | ||
var canvas = ac(); | ||
var context = canvas.getContext('2d'); | ||
// draw a purple background | ||
context.fillStyle = 'purple'; | ||
context.fillRect(0, 0, canvas.width, canvas.height); | ||
// write some text | ||
context.fillStyle = '#00f'; | ||
context.font = 'italic 15px sans-serif'; | ||
context.textBaseline = 'top'; | ||
context.fillText ('Hello world!', 1, 1); | ||
context.font = 'bold 20px sans-serif'; | ||
context.strokeText('Hello world!', 1, 21); | ||
// IMPORTANT!!! | ||
// call `canvas.render()` when you're ready to flush the canvas to the terminal | ||
canvas.render(); | ||
``` | ||
Outputs something like: | ||
![](http://i.cloudup.com/5tGgXjcRWw.png) | ||
License | ||
@@ -52,1 +82,5 @@ ------- | ||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
[canvas api]: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html | ||
[node-canvas]: https://github.com/learnboost/node-canvas |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12315
340
84