Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
draw lines and shapes on the terminal
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
example
README.markdown
index.js
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.