Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@mixmaxhq/blessed
Advanced tools
A curses-like library with a high level terminal interface API for node.js.
Blessed is over 16,000 lines of code and terminal goodness. It's completely implemented in javascript, and its goal consists of two things:
Reimplement ncurses entirely by parsing and compiling terminfo and termcap,
and exposing a Program
object which can output escape sequences compatible
with any terminal.
Implement a widget API which is heavily optimized for terminals.
The blessed renderer makes use of CSR (change-scroll-region), and BCE (back-color-erase). It draws the screen using the painter's algorithm and is sped up with smart cursor movements and a screen damage buffer. This means rendering of your application will be extremely efficient: blessed only draws the changes (damage) to the screen.
Blessed is arguably as accurate as ncurses, but even more optimized in some ways. The widget library gives you an API which is reminiscent of the DOM. Anyone is able to make an awesome terminal application with blessed. There are terminal widget libraries for other platforms (primarily python and perl), but blessed is possibly the most DOM-like (dare I say the most user-friendly?).
Blessed has been used to implement other popular libraries and programs. Examples include: the slap text editor and blessed-contrib. The blessed API itself has gone on to inspire termui for Go.
$ npm install blessed
This will render a box with line borders containing the text 'Hello world!'
,
perfectly centered horizontally and vertically.
NOTE: It is recommend you use either smartCSR
or fastCSR
as a
blessed.screen
option. This will enable CSR when scrolling text in elements
or when manipulating lines.
var blessed = require('blessed');
// Create a screen object.
var screen = blessed.screen({
smartCSR: true
});
screen.title = 'my window title';
// Create a box perfectly centered horizontally and vertically.
var box = blessed.box({
top: 'center',
left: 'center',
width: '50%',
height: '50%',
content: 'Hello {bold}world{/bold}!',
tags: true,
border: {
type: 'line'
},
style: {
fg: 'white',
bg: 'magenta',
border: {
fg: '#f0f0f0'
},
hover: {
bg: 'green'
}
}
});
// Append our box to the screen.
screen.append(box);
// Add a png icon to the box
var icon = blessed.image({
parent: box,
top: 0,
left: 0,
type: 'overlay',
width: 'shrink',
height: 'shrink',
file: __dirname + '/my-program-icon.png',
search: false
});
// If our box is clicked, change the content.
box.on('click', function(data) {
box.setContent('{center}Some different {red-fg}content{/red-fg}.{/center}');
screen.render();
});
// If box is focused, handle `enter`/`return` and give us some more content.
box.key('enter', function(ch, key) {
box.setContent('{right}Even different {black-fg}content{/black-fg}.{/right}\n');
box.setLine(1, 'bar');
box.insertLine(1, 'foo');
screen.render();
});
// Quit on Escape, q, or Control-C.
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
});
// Focus our element.
box.focus();
// Render the screen.
screen.render();
Blessed comes with a number of high-level widgets so you can avoid all the nasty low-level terminal stuff.
The base node which everything inherits from.
box
).i
.The screen on which every other node renders.
Program
to be associated with. Will be
automatically instantiated if none is provided.smartCSR
, but may cause flickering depending on
what is on each side of the element.back_color_erase
optimizations for terminals
that support it. It will also work with terminals that don't support it, but
only on lines with the default background color. As it stands with the current
implementation, it's uncertain how much terminal performance this adds at the
cost of overhead within node.null
is default).log
method.log
option if set as a boolean.debug
method. Also creates a
debug console which will display when pressing F12. It will display all log
and debug messages.C-c
) to ignore
when keys are locked or grabbed. Useful for creating a key that will always
exit no matter whether the keys are locked.┌─────────┌─────────┐
│ box1 │ box2 │
└─────────└─────────┘
Become:
┌─────────┬─────────┐
│ box1 │ box2 │
└─────────┴─────────┘
'??'
, '?'
, ''
respectively. (NOTE: iTerm2 cannot display
combining characters properly. Blessed simply removes them from an element's
content if iTerm2 is detected).true
unicode
is forced. If value is false
non-unicode is forced (default: null
).process.stdin
/process.stdout
by default, however, it could be a net.Socket
if you want to make a program
that runs over telnet or something of that nature.TERM
name used for terminfo parsing. The $TERM
env variable is
used by default.tput: true
to the Program constructor.)program.cols
).program.rows
).screen.width
.screen.height
.Set
calls screen.setTerminal()
internally.debug
option was set.screen.focused = el
).term
. Reloads terminfo.The base element.
{
fg: 'blue',
bg: 'black',
border: {
fg: 'blue'
},
scrollbar: {
bg: 'blue'
},
focus: {
bg: 'red'
},
hover: {
bg: 'red'
}
}
left
, center
, or right
.top
, middle
, or bottom
.left
, right
, top
, and bottom
.0-100%
), or keyword (half
or shrink
). Percentages can also have
offsets (50%+1
, 50%-1
).0-100%
), or keyword (center
).
right
and bottom
do not accept keywords. Percentages can also have
offsets (50%+1
, 50%-1
).
).line
or bg
). bg
by default.bg
type, default is space.fg/bg/underline
). See above.scrollable
option is enabled, Element inherits all methods
from ScrollableBox.el.on('screen', ...)
except this
will automatically keep track of which listeners are bound to the screen
object. For use with removeScreenEvent()
, free()
, and destroy()
.el.removeListener('screen', ...)
except this will automatically keep track of which listeners are bound
to the screen object. For use with onScreenEvent()
, free()
, and
destroy()
.onScreenEvent()
, removeScreenEvent()
, and destroy()
.detach()
method, except this will automatically
call free()
and unbind any screen events to prevent memory leaks. for use
with onScreenEvent()
, removeScreenEvent()
, and free()
.{text:'foo',side:'left'}
{text:'foo'}
Methods for dealing with text content, line by line. Useful for writing a text editor, irc client, etc.
Note: All of these methods deal with pre-aligned, pre-wrapped text. If you use deleteTop() on a box with a wrapped line at the top, it may remove 3-4 "real" lines (rows) depending on how long the original line was.
The lines
parameter can be a string or an array of strings. The line
parameter must be a string.
el.content
.
Assume the above formatting.setContent
, but ignore tags and remove escape
codes.getContent
, but return content with tags and
escape codes removed.A box element which draws a simple box containing content
or other elements.
An element similar to Box, but geared towards rendering simple text elements.
left
, center
, or right
.Inherits all options, properties, events, and methods from Element.
A simple line which can be line
or bg
styled.
vertical
or horizontal
.style
).Inherits all options, properties, events, and methods from Box.
DEPRECATED - Use Box with the scrollable
option instead.
A box with scrollable content.
Infinity
.childOffset
. This
in turn causes the childBase to change every time the element is scrolled.scrollTo
.DEPRECATED - Use Box with the scrollable
and alwaysScroll
options
instead.
A scrollable text box which can display and scroll text, as well as handle pre-existing newlines and escape codes.
keys
option.A box which can render content drawn as 8x14 cell characters using the terminus font.
' '
)A scrollable list which can display selectable items.
keys
option.vi
mode is enabled and the key
/
is pressed. This function accepts a callback function which should be
called with the search string. The search string is then used to jump to an
item that is found in items
.true
).2
)esc
is pressed with the keys
option).A very simple file manager for selecting files.
readdir
on cwd
and update the list items).A stylized table of text elements with a list.
2
by default:
one space on each side (only useful if the width is shrunken). table.setData([
[ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ],
[ 'Bird', 'Orange' ]
]);
A horizontal list. Useful for a main menu bar.
keys
and callback
.commands
option above).A form which can contain form elements.
A form input.
A box which allows multiline text input.
i
or enter
for insert, e
for editor,
C-e
for editor while inserting).readInput()
when the element is focused.
Automatically unfocus.submit
).cancel
).$EDITOR
, read the output from
the resulting file. Takes a callback which receives the final value.this.value
, for now.A box which allows text input.
*
).*
).A button which can be focused and allows key and mouse input.
press
.A checkbox which can be used in a form element.
check.text = ''
).checked
.An element wrapping RadioButtons. RadioButtons within this element will be mutually exclusive with each other.
A radio button which can be used in a form element.
A prompt box containing a text input, okay, and cancel buttons (automatically hidden).
A question box containing okay and cancel buttons (automatically hidden).
question
. callback
will yield the
result.A box containing a message to be displayed (automatically hidden).
A box with a spinning line to denote loading (automatically hidden).
stop
is called.A progress bar allowing various styles. This can also be used as a form input.
horizontal
or vertical
.filled
.A log permanently scrolled to the bottom.
A stylized table of text elements.
2
by default:
one space on each side (only useful if the width is shrunken). table.setData([
[ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ],
[ 'Bird', 'Orange' ]
]);
A box which spins up a pseudo terminal and renders the output. Useful for
writing a terminal multiplexer, or something similar to an mc-like file
manager. Requires term.js and pty.js to be installed. See
example/multiplex.js
for an example terminal multiplexer.
$SHELL
by default.line
, underline
, and block
.xterm
).element.screenshot
,
however, the specified region includes the terminal's entire scrollback,
rather than just what is visible on the screen.Display an image in the terminal (jpeg, png, gif) using either blessed's
internal png/gif-to-terminal renderer (using a ANSIImage element) or
using w3mimgdisplay
(using a OverlayImage element).
ansi
or overlay
. Whether to render the file as ANSI art or
using w3m
to overlay. See the ANSIImage element for
more information/options. (default: ansi
).Convert any .png
file (or .gif
, see below) to an ANSI image and display it
as an element. This differs from the OverlayImage
element in that it uses
blessed's internal PNG/GIF parser and does not require external dependencies.
Blessed uses an internal from-scratch PNG/GIF reader because no other javascript PNG reader supports Adam7 interlaced images (much less pass the png test suite).
The blessed PNG reader supports adam7 deinterlacing, animation (APNG), all color types, bit depths 1-32, alpha, alpha palettes, and outputs scaled bitmaps (cellmaps) in blessed for efficient rendering to the screen buffer. It also uses some code from libcaca/libcucul to add density ASCII characters in order to give the image more detail in the terminal.
If a corrupt PNG or a non-PNG is passed in, blessed will display error text in the element.
.gif
files are also supported via a javascript implementation (they are
internally converted to bitmaps and fed to the PNG renderer). Any other image
format is support only if the user has imagemagick (convert
and identify
)
installed.
0-1.0
) from its original pixel width/height
(Default: 1.0
).width
or height
in
that only one of them is needed: blessed will maintain the aspect ratio of
the image as it scales down to the proper number of cells. NOTE: PNG/GIF's
are always automatically shrunken to size (based on scale) if a width
or
height
is not given.true
).0.0-1.0
. Faster: 1-1000
.
It cannot go faster than 1 frame per millisecond, so 1000 is the fastest.
(Default: 1.0)mem
or cpu
. If optimizing for memory, animation frames
will be rendered to bitmaps as the animation plays, using less memory.
Optimizing for cpu will precompile all bitmaps beforehand, which may be
faster, but might also OOM the process on large images. (Default: mem
).Display an image in the terminal (jpeg, png, gif) using w3mimgdisplay. Requires w3m to be installed. X11 required: works in xterm, urxvt, and possibly other terminals.
w3m
to overlay
Internally uses the ANSIImage element. See the ANSIImage element for
more information/options. (Default: true
).w3mimgdisplay
path is not
given, blessed will search the entire disk for the binary./usr
, /bin
, and /lib
for
w3mimgdisplay
(Default: true
).spawnSync
.A box which spins up a pseudo terminal in order to render a video via mplayer -vo caca
or mpv --vo caca
. Requires mplayer
or mpv
to be installed with
libcaca support.
mplayer
or mpv
.A layout which can position children automatically based on a renderer
method
(experimental - the mechanics of this element may be changed in the
future!).
By default, the Layout element automatically positions children as if they were
display: inline-block;
in CSS.
inline
is the default and will render akin to inline-block
. grid
will create an automatic grid based on element dimensions. The grid cells'
width and height are always determined by the largest children in the layout.You must always give Layout
a width and height. This is a chicken-and-egg
problem: blessed cannot calculate the width and height dynamically before the
children are positioned.
border
and padding
are already calculated into the coords
object the
renderer
receives, so there is no need to account for it in your renderer.
Try to set position for children using el.position
. el.position
is the most
primitive "to-be-rendered" way to set coordinates. Setting el.left
directly
has more dynamic behavior which may interfere with rendering.
Some definitions for coords
(otherwise known as el.lpos
):
coords.xi
- the absolute x coordinate of the left side of a rendered
element. It is absolute: relative to the screen itself.coords.xl
- the absolute x coordinate of the right side of a rendered
element. It is absolute: relative to the screen itself.coords.yi
- the absolute y coordinate of the top side of a rendered
element. It is absolute: relative to the screen itself.coords.yl
- the absolute y coordinate of the bottom side of a rendered
element. It is absolute: relative to the screen itself.Note again: the coords
the renderer receives for the Layout already has
border and padding subtracted, so you do not have to account for these. The
children do not.
Here is an example of how to provide a renderer. Note that this is also the
default renderer if none is provided. This renderer will render each child as
though they were display: inline-block;
in CSS, as if there were a
dynamically sized horizontal grid from left to right.
var layout = blessed.layout({
parent: screen,
top: 'center',
left: 'center',
width: '50%',
height: '50%',
border: 'line',
style: {
bg: 'red',
border: {
fg: 'blue'
}
},
// NOTE: This is already the default renderer if none is provided!
renderer: function(coords) {
var self = this;
// The coordinates of the layout element
var width = coords.xl - coords.xi
, height = coords.yl - coords.yi
, xi = coords.xi
, xl = coords.xl
, yi = coords.yi
, yl = coords.yl;
// The current row offset in cells (which row are we on?)
var rowOffset = 0;
// The index of the first child in the row
var rowIndex = 0;
return function iterator(el, i) {
// Make our children shrinkable. If they don't have a height, for
// example, calculate it for them.
el.shrink = true;
// Find the previous rendered child's coordinates
var last = self.getLastCoords(i);
// If there is no previously rendered element, we are on the first child.
if (!last) {
el.position.left = 0;
el.position.top = 0;
} else {
// Otherwise, figure out where to place this child. We'll start by
// setting it's `left`/`x` coordinate to right after the previous
// rendered element. This child will end up directly to the right of it.
el.position.left = last.xl - xi;
// If our child does not overlap the right side of the Layout, set it's
// `top`/`y` to the current `rowOffset` (the coordinate for the current
// row).
if (el.position.left + el.width <= width) {
el.position.top = rowOffset;
} else {
// Otherwise we need to start a new row and calculate a new
// `rowOffset` and `rowIndex` (the index of the child on the current
// row).
rowOffset += self.children.slice(rowIndex, i).reduce(function(out, el) {
if (!self.isRendered(el)) return out;
out = Math.max(out, el.lpos.yl - el.lpos.yi);
return out;
}, 0);
rowIndex = i;
el.position.left = 0;
el.position.top = rowOffset;
}
}
// If our child overflows the Layout, do not render it!
// Disable this feature for now.
if (el.position.top + el.height > height) {
// Returning false tells blessed to ignore this child.
// return false;
}
};
}
});
for (var i = 0; i < 10; i++) {
blessed.box({
parent: layout,
width: i % 2 === 0 ? 10 : 20,
height: i % 2 === 0 ? 5 : 10,
border: 'line'
});
}
All helpers reside on blessed.helpers
or blessed
.
a
and b
into object a
.name
prop.index
prop.start
directory with name
target
.el.setContent()
.
Example: box.setContent('escaped tag: ' + blessed.escape('{bold}{/bold}'));
style
object.style
attributes to binary
format.Every element can have text content via setContent
. If tags: true
was
passed to the element's constructor, the content can contain tags. For example:
box.setContent('hello {red-fg}{green-bg}{bold}world{/bold}{/green-bg}{/red-fg}');
To make this more concise {/}
cancels all character attributes.
box.setContent('hello {red-fg}{green-bg}{bold}world{/}');
Blessed tags support the basic 16 colors for colors, as well as up to 256 colors.
box.setContent('hello {red-fg}{green-bg}world{/}');
Tags can also use hex colors (which will be reduced to the most accurate terminal color):
box.setContent('hello {#ff0000-fg}{#00ff00-bg}world{/}');
Blessed supports all terminal attributes, including bold
, underline
,
blink
, inverse
, and invisible
.
box.setContent('hello {bold}world{/bold}');
Newlines and alignment are also possible in content.
box.setContent('hello\n'
+ '{right}world{/right}\n'
+ '{center}foo{/center}\n');
+ 'left{|}right');
This will produce a box that looks like:
| hello |
| world |
| foo |
| left right |
Escaping can either be done using blessed.escape()
box.setContent('here is an escaped tag: ' + blessed.escape('{bold}{/bold}'));
Or with the special {open}
and {close}
tags:
box.setContent('here is an escaped tag: {open}bold{close}{open}/bold{close}');
Either will produce:
here is an escaped tag: {bold}{/bold}
Content can also handle SGR escape codes. This means if you got output from a
program, say git log
for example, you can feed it directly to an element's
content and the colors will be parsed appropriately.
This means that while {red-fg}foo{/red-fg}
produces ^[[31mfoo^[[39m
, you
could just feed ^[[31mfoo^[[39m
directly to the content.
The style option controls most of the visual aspects of an element.
style: {
fg: 'blue',
bg: 'black',
bold: true,
underline: false,
blink: false,
inverse: false,
invisible: false,
transparent: false,
border: {
fg: 'blue',
bg: 'red'
},
scrollbar: {
bg: 'blue'
},
focus: {
bg: 'red'
},
hover: {
bg: 'red'
}
}
Colors can be the names of any of the 16 basic terminal colors, along with hex
values (e.g. #ff0000
) for 256 color terminals. If 256 or 88 colors is not
supported. Blessed with reduce the color to whatever is available.
Blessed supports all terminal attributes, including bold
, underline
,
blink
, inverse
, and invisible
. Attributes are represented as bools in the
style
object.
Blessed can set the opacity of an element to 50% using style.transparent = true;
. While this seems like it normally shouldn't be possible in a terminal,
blessed will use a color blending algorithm to blend the element of the
foremost element with the background behind it. Obviously characters cannot be
blended, but background colors can.
Translucent shadows are also an option when it comes to styling an element. This option will create a 50% opacity 2-cell wide, 1-cell high shadow offset to the bottom-right.
shadow: true
Blessed supports hover and focus styles. (Hover is only useful is mouse input is enabled).
style: {
hover: {
bg: 'red'
},
focus: {
border: {
fg: 'blue'
}
}
}
On scrollable elements, blessed will support style options for the scrollbar, such as:
style: {
scrollbar: {
bg: 'red',
fg: 'blue'
}
}
As a main option, scrollbar will either take a bool or an object:
scrollbar: {
ch: ' '
}
Or:
scrollbar: true
Events in Blessed work similar to the traditional node.js model, with one important difference: they have a concept of a tree and event bubbling.
Events can bubble in blessed. For example:
Receiving all click events for box
(a normal event listener):
box.on('click', function(mouse) {
box.setContent('You clicked ' + mouse.x + ', ' + mouse.y + '.');
screen.render();
});
Receiving all click events for box
, as well as all of its children:
box.on('element click', function(el, mouse) {
box.setContent('You clicked '
+ el.type + ' at ' + mouse.x + ', ' + mouse.y + '.');
screen.render();
if (el === box) {
return false; // Cancel propagation.
}
});
el
gets passed in as the first argument. It refers to the target element the
event occurred on. Returning false
will cancel propagation up the tree.
Offsets may be a number, a percentage (e.g. 50%
), or a keyword (e.g.
center
).
Dimensions may be a number, or a percentage (e.g. 50%
).
Positions are treated almost exactly the same as they are in CSS/CSSOM when
an element has the position: absolute
CSS property.
When an element is created, it can be given coordinates in its constructor:
var box = blessed.box({
left: 'center',
top: 'center',
bg: 'yellow',
width: '50%',
height: '50%'
});
This tells blessed to create a box, perfectly centered relative to its parent, 50% as wide and 50% as tall as its parent.
Percentages can also have offsets applied to them:
...
height: '50%-1',
left: '45%+1',
...
To access the calculated offsets, relative to the parent:
console.log(box.left);
console.log(box.top);
To access the calculated offsets, absolute (relative to the screen):
console.log(box.aleft);
console.log(box.atop);
This still needs to be tested a bit, but it should work.
To actually render the screen buffer, you must call render
.
box.setContent('Hello {#0fe1ab-fg}world{/}.');
screen.render();
Elements are rendered with the lower elements in the children array being painted first. In terms of the painter's algorithm, the lowest indicies in the array are the furthest away, just like in the DOM.
Terminal cursors can be tricky. They all have different custom escape codes to alter. As an experimental alternative, blessed can draw a cursor for you, allowing you to have a custom cursor that you control.
var screen = blessed.screen({
cursor: {
artificial: true,
shape: 'line',
blink: true,
color: null // null for default
}
});
That's it. It's controlled the same way as the regular cursor.
To create a custom cursor:
var screen = blessed.screen({
cursor: {
artificial: true,
shape: {
bg: 'red',
fg: 'white',
bold: true,
ch: '#'
},
blink: true
}
});
Blessed supports the ability to create multiple screens. This may not seem useful at first, but if you're writing a program that serves terminal interfaces over http, telnet, or any other protocol, this can be very useful.
A simple telnet server might look like this (see examples/blessed-telnet.js for a full example):
var blessed = require('blessed');
var telnet = require('telnet2');
telnet({ tty: true }, function(client) {
client.on('term', function(terminal) {
screen.terminal = terminal;
screen.render();
});
client.on('size', function(width, height) {
client.columns = width;
client.rows = height;
client.emit('resize');
});
var screen = blessed.screen({
smartCSR: true,
input: client,
output: client,
terminal: 'xterm-256color',
fullUnicode: true
});
client.on('close', function() {
if (!screen.destroyed) {
screen.destroy();
}
});
screen.key(['C-c', 'q'], function(ch, key) {
screen.destroy();
});
screen.on('destroy', function() {
if (client.writable) {
client.destroy();
}
});
screen.data.main = blessed.box({
parent: screen,
left: 'center',
top: 'center',
width: '80%',
height: '90%',
border: 'line',
content: 'Welcome to my server. Here is your own private session.'
});
screen.render();
}).listen(2300);
Once you've written something similar and started it, you can simply telnet into your blessed app:
$ telnet localhost 2300
Creating a netcat server would also work as long as you disable line buffering
and terminal echo on the commandline via stty
:
$ stty -icanon -echo; ncat localhost 2300; stty icanon echo
Or by using netcat's -t
option: $ ncat -t localhost 2300
Creating a streaming http 1.1 server than runs in the terminal is possible by
curling it with special arguments: $ curl -sSNT. localhost:8080
.
There are currently no examples of netcat/nc/ncat or http->curl servers yet.
The blessed.screen
constructor can accept input
, output
, and term
arguments to aid with this. The multiple screens will be managed internally by
blessed. The programmer just has to keep track of the references, however, to
avoid ambiguity, it's possible to explicitly dictate which screen a node is
part of by using the screen
option when creating an element.
The screen.destroy()
method is also crucial: this will clean up all event
listeners the screen has bound and make sure it stops listening on the event
loop. Make absolutely certain to remember to clean up your screens once you're
done with them.
A tricky part is making sure to include the ability for the client to send the TERM which is reset on the serverside, and the terminal size, which is should also be reset on the serverside. Both of these capabilities are demonstrated above.
For a working example of a blessed telnet server, see
examples/blessed-telnet.js
.
Currently there is no mouse
or resize
event support on Windows.
Windows users will need to explicitly set term
when creating a screen like so
(NOTE: This is no longer necessary as of the latest versions of blessed.
This is now handled automatically):
var screen = blessed.screen({ terminal: 'windows-ansi' });
This will actually parse the xterm terminfo and compile every string capability to a javascript function:
var blessed = require('blessed');
var tput = blessed.tput({
terminal: 'xterm-256color',
extended: true
});
process.stdout.write(tput.setaf(4) + 'Hello' + tput.sgr0() + '\n');
To play around with it on the command line, it works just like tput:
$ tput.js setaf 2
$ tput.js sgr0
$ echo "$(tput.js setaf 2)Hello World$(tput.js sgr0)"
The main functionality is exposed in the main blessed
module:
var blessed = require('blessed')
, program = blessed.program();
program.key('q', function(ch, key) {
program.clear();
program.disableMouse();
program.showCursor();
program.normalBuffer();
process.exit(0);
});
program.on('mouse', function(data) {
if (data.action === 'mousemove') {
program.move(data.x, data.y);
program.bg('red');
program.write('x');
program.bg('!red');
}
});
program.alternateBuffer();
program.enableMouse();
program.hideCursor();
program.clear();
program.move(1, 1);
program.bg('black');
program.write('Hello world', 'blue fg');
program.setx((program.cols / 2 | 0) - 4);
program.down(5);
program.write('Hi again!');
program.bg('!black');
program.feed();
Most tests contained in the test/
directory are interactive. It's up to the
programmer to determine whether the test is properly displayed. In the future
it might be better to do something similar to vttest.
Examples can be found in examples/
.
ncurses-base
package and the ncurses-term
package. (#98)127
to 255
. If
you're not happy with this, you may want to look into using xterm or urxvt,
or a terminal which uses a modern VTE, like gnome-terminal.If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. </legalese>
Copyright (c) 2013-2015, Christopher Jeffrey. (MIT License)
See LICENSE for more info.
FAQs
A high-level terminal interface library for node.js.
The npm package @mixmaxhq/blessed receives a total of 0 weekly downloads. As such, @mixmaxhq/blessed popularity was classified as not popular.
We found that @mixmaxhq/blessed demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 23 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.