Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

draw lines and shapes on the terminal

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 example
Octocat-spinner-32 README.markdown
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
README.markdown

surrender

Draw lines and shapes on the terminal.

examples

rhombus.js

var render = require('surrender')({
    from : [ [ -1, 1 ], [ -1, 1 ] ]
});

render
    .line([ -0.7, 0 ], [ 0, -0.5 ])
    .line([ 0, -0.5 ], [ 0.7, 0 ])
    .line([ 0.7, 0 ], [ 0, 0.5 ])
    .line([ 0, 0.5 ], [ -0.7, 0 ])
;

output:




                                       \____
                                  /¯¯¯¯     \____
                             /¯¯¯¯               \___
                         /¯¯¯                        \____
                    /¯¯¯¯                                 \____
               /¯¯¯¯                                           \____
           \____                                                   /¯¯¯
                \____                                         /¯¯¯¯
                     \____                               /¯¯¯¯
                          \____                     /¯¯¯¯
                               \___            /¯¯¯¯
                                   \____   /¯¯¯



methods

var surrender = require('surrender')

var render = surrender(opts)

Create a new surrender object from opts.

The optional opts.from specifies a coordinate transform using coords so you don't need to think in cursor coordinates.

You can use opts.charm to pass in a custom charm instance.

render.line([ x0, y0 ], [ x1, y1 ])

Draw a line from [ x0, y0 ] to [ x1, y1 ].

Returns this.

install

Using npm do:

npm install surrender

license

MIT/X11

Something went wrong with that request. Please try again.