How to use the List function from blessed
Find comprehensive JavaScript blessed.List code examples handpicked from public code repositorys.
blessed.List is a class in the Blessed library that creates a scrollable list widget for the terminal.
GitHub: schultyy/hyrule
190 191 192 193 194 195 196 197 198 199
} }); }; MainWindow.prototype.createList = function() { return blessed.List({ top: 3, fg: '#255E69', border: { type: 'line'
+ 8 other calls in file
How does blessed.List work?
blessed.List is a class in the blessed library that creates a scrollable list widget in the terminal interface that can be used to display a list of items, and handle user interactions such as scrolling and selecting items. It provides various properties and methods for configuring and manipulating the list, such as scroll, select, add, and remove.
GitHub: typon/gudb-obsolete
105 106 107 108 109 110 111 112 113 114
width: cts.varBoxProps.width, vi: true, tags: true, keys: true, }); this._stackBox = blessed.List({ name: 'stackBox', label: 'Stack', parent: this._layout, scrollable: true,
+ 17 other calls in file
Ai Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
const blessed = require("blessed"); // create a screen object const screen = blessed.screen({ smartCSR: true, }); // create a list const list = blessed.list({ parent: screen, top: "center", left: "center", width: "50%", height: "50%", border: { type: "line", }, style: { fg: "white", border: { fg: "#f0f0f0", }, selected: { bg: "blue", }, }, items: ["Item 1", "Item 2", "Item 3"], }); // select the first item in the list list.select(0); // handle key events screen.key(["up", "down"], function (ch, key) { if (key.name === "up") { list.up(); } else if (key.name === "down") { list.down(); } screen.render(); }); // render the screen screen.render();
In this example, a blessed.List is created and added to a blessed.Screen. The list is given a width and height of 50%, and its items are set to an array of three strings. The first item is selected by default. Finally, the screen is rendered and key events are handled to allow the user to navigate the list.
GitHub: fancn21th/oh-file-name
15 16 17 18 19 20 21 22 23 24
top: 1, left: 1, content: `${g('本机所有字体陈列如下')}\n${g('All fonts available on your OS')}` }); const fontList = blessed.List({ top: 'center', left: 'center', width: '80%', height: '80%',
GitHub: moofoo/dnv
279 280 281 282 283 284 285 286 287 288 289
this.items[i].setContent(display); this.ritems[i] = content; }; blessed.List.prototype.add = blessed.List.prototype.addItem = blessed.List.prototype.appendItem = function (content) { content = typeof content === 'string'
blessed.box is the most popular function in blessed (4356 examples)