Skip to content

Instantly share code, notes, and snippets.

@keevitaja
Created June 6, 2017 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keevitaja/d9eac64930c85caf8a190f27d5f5732c to your computer and use it in GitHub Desktop.
Save keevitaja/d9eac64930c85caf8a190f27d5f5732c to your computer and use it in GitHub Desktop.
const blessed = require('blessed')
const colors = require('colors')
const screen = blessed.screen({
smartCSR: true
})
let index = 0
let page = []
const display = blessed.box({
parent: screen,
left: 0,
top: 0,
width: "100%",
height: "100%"
})
const add = ()=> {
for (let j = 0; j < 10; j++) {
let rand = Math.random().toString()
page.push(index + ': ' + rand.red + rand.green + rand.yellow + rand.blue)
index++
}
display.setContent(page.slice(-60).join('\n'))
screen.render()
}
screen.key('C-q', function() {
process.exit(0)
})
screen.key('C-a', function() {
add()
})
add()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment