* Adding for history; will be removed
This commit is contained in:
parent
48be2f69be
commit
6f9414fc1c
|
@ -288,6 +288,7 @@ function ANSIEscapeParser(options) {
|
||||||
|
|
||||||
// :TODO: finish this system
|
// :TODO: finish this system
|
||||||
// * style is map of styleName -> boolean
|
// * style is map of styleName -> boolean
|
||||||
|
// * change self.style -> self.styles
|
||||||
// * Change all fg/bg/etc -> self.state.color { fg, bg, style{} }
|
// * Change all fg/bg/etc -> self.state.color { fg, bg, style{} }
|
||||||
// * Change all refs to use this new system
|
// * Change all refs to use this new system
|
||||||
// * When passing color -> sgr, iterate enabled styles -> additional params
|
// * When passing color -> sgr, iterate enabled styles -> additional params
|
||||||
|
|
|
@ -323,6 +323,25 @@ function sgr() {
|
||||||
return ESC_CSI + result + 'm';
|
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
|
// Shortcuts for common functions
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in New Issue