I'm using blessed and blessed-contrib to create a terminal based dashboard, and for some of the logs I was going to implement some formatting (bold, italics, underlined, strikethrough, color, etc). And when I try to run a simple test with the below script (which is just a modified blessed-contrib example):
var blessed = require('blessed')
, contrib = require('blessed-contrib')
, screen = blessed.screen()
, log = contrib.log(
{ fg: "grey"
, label: 'Server Log'
, height: "20%"
, tags: true
, border: {type: "line", fg: "cyan"} })
screen.append(log)
var i = 0
setInterval(function() {
log.log(new Date().toISOString() + " \x1B[1mBold\x1B[0m, \x1B[3mItalic\x1B[0m, \x1B[4mUnderline\x1B[0m, \x1B[9mStrikethrough\x1B[0m, \x1B[31mRed font\x1B[0m")}, 500)
screen.render()
The output I get shows that only the bold and underline formatting seem to work: enter image description here
Just to be sure it wasn't some limitation with my terminal or some issue with NodeJS, I created a script with just the following:
console.log(new Date().toISOString() + " \x1B[1mBold\x1B[0m, \x1B[3mItalic\x1B[0m, \x1B[4mUnderline\x1B[0m, \x1B[9mStrikethrough\x1B[0m, \x1B[31mRed font\x1B[0m")
And it worked just fine: enter image description here
I tried using some libraries to add styling to the text (eg: chalk), but those had the same issue.
Is there a way to use such font modifiers in blessed/blessed-contrib components?