mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-11 07:04:32 +02:00
* Start of work on re-write of SGR stuff related to MCI codes
This commit is contained in:
parent
48be2f69be
commit
3f29e3dba4
10 changed files with 110 additions and 94 deletions
|
@ -19,6 +19,7 @@ var _ = require('lodash');
|
|||
exports.getFGColorValue = getFGColorValue;
|
||||
exports.getBGColorValue = getBGColorValue;
|
||||
exports.sgr = sgr;
|
||||
exports.getSGRFromGraphicRendition = getSGRFromGraphicRendition;
|
||||
exports.clearScreen = clearScreen;
|
||||
exports.resetScreen = resetScreen;
|
||||
exports.normal = normal;
|
||||
|
@ -323,6 +324,21 @@ function sgr() {
|
|||
return ESC_CSI + result + 'm';
|
||||
}
|
||||
|
||||
//
|
||||
// Converts a Graphic Rendition object used elsewhere
|
||||
// to a ANSI SGR sequence
|
||||
//
|
||||
function getSGRFromGraphicRendition(graphicRendition) {
|
||||
var sgrSeq = graphicRendition.styles.slice(0); // start out with styles
|
||||
if(graphicRendition.fg) {
|
||||
sgrSeq.push(graphicRendition.fg);
|
||||
}
|
||||
if(graphicRendition.bg) {
|
||||
sgrSeq.push(graphicRendition.bg);
|
||||
}
|
||||
return sgr(sgrSeq);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Shortcuts for common functions
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue