chjj / blessed

A high-level terminal interface library for node.js.
Other
11.27k stars 533 forks source link

center tag doesn't work #379

Open ElModdy opened 5 years ago

ElModdy commented 5 years ago

Hi, I modified one of the example but it doesn't work. I would like to center the title. This is what I tried.

var blessed = require('blessed');

// Create a screen object.
var screen = blessed.screen({
  smartCSR: true
});

screen.title = 'my window title';

var content = '{center}Title {bold}FOO{/bold}{/center}\nThis is some random text'

// Create a box perfectly centered horizontally and vertically.
var box = blessed.box({
    top: 'center',
    left: 'center',
    width: 'shrink',
    height: 'shrink',
    content: content,
    tags: true,
    border: {
        type: 'line'
    },
    style: {
        fg: 'white',
        bg: 'magenta',
        border: {
            fg: '#f0f0f0'
        }
    }
});

// Append our box to the screen.
screen.append(box);

// Quit on Escape, q, or Control-C.
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
  return process.exit(0);
});

// Focus our element.
box.focus();

// Render the screen.
screen.render();

This is what I see: prova