const Dashboard = function Dashboard(options) { this.options = options || {}; this.settings = this.options.settings; this.screen = blessed.screen({ smartCSR: true, title: options.appName }); this.logProvider = new LogProvider(this.screen); this.metricsProvider = new MetricsProvider(this.screen); this._createViews(); this._configureKeys(); this.screen.render(); }
const MockScreen = function MockScreen() { // organized by primitive, Object, stubs, alphabetically Object.assign(this, { program: new MockProgram(), type: "screen", clickable: [], keyable: [], _listenKeys: blessed.screen.prototype._listenKeys, _listenMouse: sandbox.stub(), append: sandbox.stub(), remove: sandbox.stub(), render: sandbox.stub(), restoreFocus: sandbox.stub(), rewindFocus: sandbox.stub(), saveFocus: sandbox.stub(), setEffects: sandbox.stub() }); EventEmitter.call(this); if (stubEvents === undefined || stubEvents) { sandbox.stub(this, "on"); } }
function showResultsInDiagram(result) { var blessed = require('blessed'), screen = blessed.screen(); const contrib = require('blessed-contrib'); var barCharts = contrib.bar({ label: 'CPU tasks vs Memory', barWidth: 4, barSpacing: 6, xOffset: 0, height: "60%", width: "50%", maxHeight: 4 }) screen.append(barCharts) barCharts.setData({ titles: [result[0].name , result[1].name , result[2].name], data: [result[0].time, result[1].time, result[2].time] }) screen.render(); }
const render = (artist, title, lyrics) => { const screenTitle = chalk.yellow.bold(`${artist} - ${title}`) const highlightedLyrics = lyrics.replace(/^\[(.+)\]/gm, chalk.green.bold('[$1]')) const content = [screenTitle, '\n', highlightedLyrics].join('\n') const screen = blessed.screen({ smartCSR: true, fullUnicode: true }) const box = blessed.box({ width: '85%', height: '85%', left: 'center', top: 'center', scrollable: true, alwaysScroll: true, keys: true, vi: true, content: content }) screen.append(box) screen.render() screen.key(['escape', 'q', 'C-c'], () => process.exit(0)) return screen }
function renderChart(assetsData){ var blessed = require('blessed') , contrib = require('blessed-contrib') , screen = blessed.screen(); let titles=[],data=[],total = 0; for(let item in assetsData){ titles.push(item); data.push(assetsData[item].toFixed(1)); total += assetsData[item]; } var bar = contrib.bar( { label: chalk.blue('total assets size is : ') + chalk.yellow(`${total.toFixed(2)} kb`) + chalk.blue('. The details are as follows (kb): \n') , barWidth: 8 , barSpacing: 10 , xOffset: 5 , maxHeight: 7 , barBgColor: 'green' , barFgColor: 'red' }); screen.append(bar); //must append before setting data bar.setData({ titles, data }); screen.render(); }
/** * Setup the screen (blessed) * * @return {boolean} True */ screenSetup() { this._screen = blessed.screen({ 'autoPadding': true, 'fullUnicode': true, 'dockBorders': true }); this._screen.key('C-q', () => { this._screen.destroy(); process.exit(0); }); this._screen.key('C-t', () => { this.popupSubredditsMine(); }); this._screen.title = 'Snoo'; return true; }
const screen = blessed.screen() const bookTable = blessedContrib.table({ fg: 'white',
screen = blessed.screen({ input: ttys.stdin, output: process.stdout
const screen = blessed.screen({ smartCSR: true })
this.screen = blessed.screen({ smartCSR: true, fullUnicode: true, dockBorders: true }); this.screen.title = 'slack-tui'; this.teamBox = blessed.list({ top: 0, keys: true }); this.screen.append(this.teamBox); this.channelBox = blessed.list({ top: '25%', keys: true }); this.screen.append(this.channelBox); this.userBox = blessed.list({ top: '50%', keys: true }); this.screen.append(this.userBox); this.contentBox = blessed.log({ top: 0, scrollable: true });