{"name":"charm","version":"0.0.6","description":"ansi control sequences for terminal cursor hopping and colors","main":"index.js","directories":{"lib":".","example":"example","test":"test"},"repository":{"type":"git","url":"git://github.com/substack/node-charm.git"},"keywords":["terminal","ansi","cursor","color","console","control","escape","sequence"],"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"license":"MIT/X11","engine":{"node":">=0.4"},"_npmUser":{"name":"substack","email":"mail@substack.net"},"_id":"charm@0.0.6","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.4.12","_defaultsLoaded":true,"dist":{"shasum":"06fee14a4afb0869d46052db5087c905e52fb457","tarball":"http://registry-npm.ywwl.com/charm/download/charm-0.0.6.tgz","integrity":"sha512-Yiu8H/eW4Bs1zknCWoRurzu+oS/ZT51znVsTooEsF+jCRSNZJabMKeyaCVAx5tt5jptMofrKn3QdPfoqEg/0YQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGCheJ+yq/swXXo+aEVuWIqXUy8qLl4FnlxnaxEtui55AiA/oA2QdcQKy6FxqwEfEx3NfmJYPzd1hhqIthETxZNGwQ=="}],"size":4540,"noattachment":false,"key":"/charm/-/charm-0.0.6.tgz"},"maintainers":[{"name":"substack","email":"mail@substack.net"}],"readme":"charm\n=====\n\nUse\n[ansi terminal characters](http://www.termsys.demon.co.uk/vtansi.htm)\nto write colors and cursor positions.\n\n![me lucky charms](http://substack.net/images/charms.png)\n\nexample\n=======\n\nlucky\n-----\n\n````javascript\nvar charm = require('charm')();\ncharm.pipe(process.stdout);\ncharm.reset();\n\nvar colors = [ 'red', 'cyan', 'yellow', 'green', 'blue' ];\nvar text = 'Always after me lucky charms.';\n\nvar offset = 0;\nvar iv = setInterval(function () {\n    var y = 0, dy = 1;\n    for (var i = 0; i < 40; i++) {\n        var color = colors[(i + offset) % colors.length];\n        var c = text[(i + offset) % text.length];\n        charm\n            .move(1, dy)\n            .foreground(color)\n            .write(c)\n        ;\n        y += dy;\n        if (y <= 0 || y >= 5) dy *= -1;\n    }\n    charm.position(0, 1);\n    offset ++;\n}, 150);\n````\n\nevents\n======\n\nCharm objects pass along the data events from their input stream except for\nevents generated from querying the terminal device.\n\nBecause charm puts stdin into raw mode, charm emits two special events: \"^C\" and\n\"^D\" when the user types those combos. It's super convenient with these events\nto do:\n\n````javascript\ncharm.on('^C', process.exit)\n````\n\nThe above is set on all `charm` streams. If you want to add your own handling for these\nspecial events simply:\n\n````javascript\ncharm.removeAllListeners('^C')\ncharm.on('^C', function () {\n  // Don't exit. Do some mad science instead.\n})\n````\n\nmethods\n=======\n\nvar charm = require('charm')(param or stream, ...)\n--------------------------------------------------\n\nCreate a new readable/writable `charm` stream.\n\nYou can pass in readable or writable streams as parameters and they will be\npiped to or from accordingly. You can also pass `process` in which case\n`process.stdin` and `process.stdout` will be used.\n\nYou can `pipe()` to and from the `charm` object you get back.\n\ncharm.reset()\n-------------\n\nReset the entire screen, like the /usr/bin/reset command.\n\ncharm.destroy(), charm.end()\n----------------------------\n\nEmit an `\"end\"` event downstream.\n\ncharm.write(msg)\n----------------\n\nPass along `msg` to the output stream.\n\ncharm.position(x, y)\n--------------------\n\nSet the cursor position to the absolute coordinates `x, y`.\n\ncharm.position(cb)\n------------------\n\nQuery the absolute cursor position from the input stream through the output\nstream (the shell does this automatically) and get the response back as\n`cb(x, y)`.\n\ncharm.move(x, y)\n----------------\n\nMove the cursor position by the relative coordinates `x, y`.\n\ncharm.up(y)\n-----------\n\nMove the cursor up by `y` rows.\n\ncharm.down(y)\n-------------\n\nMove the cursor down by `y` rows.\n\ncharm.left(x)\n-------------\n\nMove the cursor left by `x` columns.\n\ncharm.right(x)\n--------------\n\nMove the cursor right by `x` columns.\n\ncharm.push(withAttributes=false)\n--------------------------------\n\nPush the cursor state and optionally the attribute state.\n\ncharm.pop(withAttributes=false)\n-------------------------------\n\nPop the cursor state and optionally the attribute state.\n\ncharm.erase(s)\n--------------\n\nErase a region defined by the string `s`.\n\n`s` can be:\n\n* end - erase from the cursor to the end of the line\n* start - erase from the cursor to the start of the line\n* line - erase the current line\n* down - erase everything below the current line\n* up - erase everything above the current line\n* screen - erase the entire screen\n\ncharm.delete(mode, n)\n---------------------\nDelete `'line'` or `'char'`s. `delete` differs from erase\nbecause it does not write over the deleted characters with whitesapce,\nbut instead removes the deleted space.\n\n`mode` can be `'line'` or `'char'`. `n` is the number of items to be deleted.\n`n` must be a positive integer.\n\nThe cursor position is not updated.\n\ncharm.insert(mode, n)\n---------------------\n\nInsert space into the terminal. `insert` is the opposite of` delete`,\nand the arguments are the same.\n\ncharm.display(attr)\n-------------------\n\nSet the display mode with the string `attr`.\n\n`attr` can be:\n\n* reset\n* bright\n* dim\n* underscore\n* blink\n* reverse\n* hidden\n\ncharm.foreground(color)\n-----------------------\n\nSet the foreground color with the string `color`, which can be:\n\n* red\n* yellow\n* green\n* blue\n* cyan\n* magenta\n* black\n* white\n\nor `color` can be an integer from 0 to 255, inclusive.\n\ncharm.background(color)\n-----------------------\n\nSet the background color with the string `color`, which can be:\n\n* red\n* yellow\n* green\n* blue\n* cyan\n* magenta\n* black\n* white\n\nor `color` can be an integer from 0 to 255, inclusive.\n\ncharm.cursor(visible)\n---------------------\n\nSet the cursor visibility with a boolean `visible`.\n\ninstall\n=======\n\nWith [npm](http://npmjs.org) do:\n\n```\nnpm install charm\n```\n","publish_time":1329866851333,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","_cnpm_publish_time":1329866851333,"dist-tags":{"latest":"1.0.2"}}