How to use the blessed.element function in blessed

To help you get started, we’ve selected a few blessed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gistia / json-log-viewer / src / widgets / MainPanel.js View on Github external
{ title: 'Level', key: 'level', format: v => levelColors[v](v) },
      { title: 'D', key: 'data', length: 1, format: v => _.isEmpty(v) ? ' ' : '*' },
      { title: 'Message', key: 'message' },
    ];

    const highlight = (row, index) => {
      const str = row.split('\n')[0];
      if (index === this.relativeRow) {
        return `{white-bg}{black-fg}${str}{/}`;
      }
      return str;
    };

    const content = formatRows(
      this.rows, columns, this.colSpacing, this.pageWidth-1).map(highlight).join('\n');
    const list = blessed.element({ tags: true, content });
    this.append(list);
    this.screen.render();
    if (notify) {
      this.setUpdated();
    }
  }
}
github heapwolf / lev / lib / ui / manifests.js View on Github external
bottom: 2,
    width: 1,
    height: 1
  })

  var cap_right = blessed.element({
    parent: manifests.box,
    content: '┤',
    right: 0,
    bottom: 2,
    width: 1,
    height: 1
  })


  var cap_upper = blessed.element({
    parent: manifests.box,
    content: '┬',
    left: width,
    top: 0,
    width: 1,
    height: 1
  })

  var cap_lower = blessed.element({
    parent: manifests.box,
    content: '┴',
    left: width,
    bottom: 2,
    height: 1,
    width: 1
  })
github heapwolf / lev / lib / ui / connections.js View on Github external
})

  var cap_upper = blessed.element({
    parent: connections,
    content: '┬',
    style: {
      bg: 'white',
      fg: 247,
    },
    left: sidePanelWidth,
    top: 0,
    width: 1,
    height: 1
  })

  var cap_lower = blessed.element({
    parent: connections,
    content: '┴',
    style: {
      bg: 'white',
      fg: 247,
    },
    left: sidePanelWidth,
    bottom: 2,
    height: 1,
    width: 1
  })

  return connections
}
github heapwolf / lev / lib / ui / info.js View on Github external
bg: 239,
          fg: 'white'
        }
      }
    },
    border: {
      bg: 'white',
      fg: 247,
      type: 'ascii'
    }
  })

  info._.usageLabelText = 'Disk usage '
  info._.client = client

  info._.usageLabel = blessed.element({
    parent: info,
    content: info._.usageLabelText,
    left: 2,
    right: 2,
    top: 2,
    height: 1,
    style: {
      bg: 'white',
      fg: 'black',
    }
  })

  info._.header = blessed.element({
    parent: info,
    left: 2,
    right: 2,
github gistia / json-log-viewer / src / widgets / LogDetails.js View on Github external
update() {
    if (this.el) {
      this.el.detach();
      this.el = null;
    }
    const content = this.json
      ? JSON.stringify(this.entry, null, 2)
      : formatObject(this.entry);
    this.el = blessed.element({
      scrollable: true,
      alwaysScroll: true,
      keys: true,
      scrollbar: { ch: ' ', track: { bg: 'grey' }, style: { bg: 'yellow' } },
      tags: true,
      content,
    });
    this.el.on('keypress', this.handleKeyPress.bind(this));
    this.el.focus();

    this.append(this.el);
    this.screen.render();
  }
}
github heapwolf / lev / lib / ui / manifests.js View on Github external
orientation: 'vertical',
    left: width,
    top: 1,
    bottom: 2
  })

  var sep_h = blessed.line({
    parent: manifests.box,
    orientation: 'horizontal',
    left: width,
    bottom: 2,
    right: 0,
    left: 0
  })

  var cap_left = blessed.element({
    parent: manifests.box,
    content: '├',
    left: 0,
    bottom: 2,
    width: 1,
    height: 1
  })

  var cap_right = blessed.element({
    parent: manifests.box,
    content: '┤',
    right: 0,
    bottom: 2,
    width: 1,
    height: 1
  })
github heapwolf / lev / lib / ui / connections.js View on Github external
var formLabelRemote = blessed.element({
    parent: form,
    content: ['Name\n\nType\n\nKey Encoding                Value Encoding',
              '\n\n\n\nPort\n\nHost\n\nManifest File'].join(''),
    left: 1,
    style: {
      bg: 'white',
      fg: 'black',
    },
    top: 1,
    left: sidePanelWidth + 1,
    right: 1,
    height: 14
  })

  var formLabelLocal = blessed.element({
    parent: form,
    content: ['Name\n\nType\n\nKey Encoding                Value Encoding',
              '\n\n\n\nPath\n\nCache Size\n\nCompression'].join(''),
    left: 1,
    style: {
      bg: 'white',
      fg: 'black',
    },
    top: 1,
    left: sidePanelWidth + 1,
    right: 1,
    hidden: true,
    height: 14
  })

  var textName = blessed.textbox({
github heapwolf / lev / lib / ui / query.js View on Github external
content: ' Exec ',
    align: 'center',
    style: {
      bg: 243,
      fg: 'white',
      focus: {
        bg: 'black'
      }
    },
    hoverBg: 'black',
    hoverFg: 'white',
    autoFocus: true,
    mouse: true
  })

  var qLabel = blessed.element({
    parent: query,
    content: 'Start\n\nEnd\n\nReverse\n\nLimit',
    left: 2,
    style: {
      bg: 'white',
      fg: 'black',
    },
    top: 2,
    width: 15,
    height: 8
  })

  var textStart = blessed.textbox({
    parent: query,
    mouse: true,
    keys: true,