* Adding for history; will be removed

This commit is contained in:
Bryan Ashby 2015-04-29 21:53:01 -06:00
parent 48be2f69be
commit 6f9414fc1c
2 changed files with 20 additions and 0 deletions

View File

@ -288,6 +288,7 @@ function ANSIEscapeParser(options) {
// :TODO: finish this system
// * style is map of styleName -> boolean
// * change self.style -> self.styles
// * Change all fg/bg/etc -> self.state.color { fg, bg, style{} }
// * Change all refs to use this new system
// * When passing color -> sgr, iterate enabled styles -> additional params

View File

@ -323,6 +323,25 @@ function sgr() {
return ESC_CSI + result + 'm';
}
function ansiFromColor(color) {
var sgrParams = [];
for(var k in color.styles) {
if(true === color.styles[k]) {
sgrParams.push(k);
}
}
if(color.fg) {
sgrParams.push(color.fg);
}
if(color.bg) {
sgrParams.push(color.bg);
}
return sgr(sgrParams);
}
///////////////////////////////////////////////////////////////////////////////
// Shortcuts for common functions
///////////////////////////////////////////////////////////////////////////////