{"_id":"charm_inheritance-fix","_rev":"3-bf5ef8fcc454304da8291f17f56eab6f","name":"charm_inheritance-fix","description":"ansi control sequences for terminal cursor hopping and colors (fixed for io.js and newer node)","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"charm_inheritance-fix","version":"1.0.1","description":"ansi control sequences for terminal cursor hopping and colors (fixed for io.js and newer node)","main":"index.js","directories":{"lib":".","example":"example","test":"test"},"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/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"},"gitHead":"f3692d00b39cb7457964a7769bb27972bd63bf6c","bugs":{"url":"https://github.com/martinheidegger/node-charm/issues"},"homepage":"https://github.com/martinheidegger/node-charm#readme","_id":"charm_inheritance-fix@1.0.1","scripts":{},"_shasum":"ad981aa05cbec00855f417549496186b82a6f93a","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"leichtgewicht","email":"mh@leichtgewicht.at"},"maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"dist":{"shasum":"ad981aa05cbec00855f417549496186b82a6f93a","tarball":"https://registry.npmjs.org/charm_inheritance-fix/-/charm_inheritance-fix-1.0.1.tgz","integrity":"sha512-+uv5rxSxgmOA4sdUKFkH5/gd2CD+UKmVhXvyBz78hgrH1xU7Rr6p9Z2tLAoaMuLukwOuvAp2VOveg3Oas2LGsA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDG2/kxfXMWzi5BaZkQSS9q1JIsGb+Rdd9YfzIG58UiBAiB8ut52Ybfz/KLzWdT+0enk72w58EgprOnukKCg8oVWsw=="}]}}},"readme":"charm_inheritance-fix\n=====================\n\nPublished fix for [#24](https://github.com/substack/node-charm/pull/24) because I needed it...\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_inheritance-fix')();\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_inheritance-fix')(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","maintainers":[{"name":"leichtgewicht","email":"mh@leichtgewicht.at"}],"time":{"modified":"2022-06-13T05:53:50.147Z","created":"2015-09-15T18:58:20.474Z","1.0.1":"2015-09-15T18:58:20.474Z"},"homepage":"https://github.com/martinheidegger/node-charm#readme","keywords":["terminal","ansi","cursor","color","console","control","escape","sequence"],"repository":{"type":"git","url":"git+ssh://git@github.com/martinheidegger/node-charm.git"},"author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"bugs":{"url":"https://github.com/martinheidegger/node-charm/issues"},"license":"MIT/X11","readmeFilename":"README.markdown"}