Skip to content

Instantly share code, notes, and snippets.

@keevitaja
Last active June 6, 2017 10:23
Show Gist options
  • Save keevitaja/01ca946295a8e25897a192126f5b7150 to your computer and use it in GitHub Desktop.
Save keevitaja/01ca946295a8e25897a192126f5b7150 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
const display = blessed.box({
parent: screen,
scrollable: true,
alwaysScroll: true,
left: 0,
top: 0,
width: "100%",
height: "100%"
})
const add = ()=> {
for (let j = 0; j < 20; j++) {
let rand = Math.random().toString()
display.pushLine(index + ': ' + rand.red + rand.green + rand.yellow + rand.blue)
index++
}
display.setScrollPerc(100)
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