🔧 Update color rendering logic and upgrade script dependencies
This commit is contained in:
@@ -414,7 +414,7 @@ interface ColorToken {
|
||||
color?: string;
|
||||
}
|
||||
|
||||
function parseColorTokens(message: string, renderColor: boolean): ColorToken[] {
|
||||
function parseColorTokens(message: string): ColorToken[] {
|
||||
const tokens: ColorToken[] = [];
|
||||
if (message) {
|
||||
let inColorStart = false;
|
||||
@@ -588,11 +588,11 @@ function __getColorCode(color: string): string {
|
||||
return COLOR_MAP[color];
|
||||
}
|
||||
|
||||
function renderColorTokens(tokens: ColorToken[]): string {
|
||||
function renderColorTokens(tokens: ColorToken[], renderColor: bool): string {
|
||||
const text: string[] = [];
|
||||
const colorMapStack = new Map<string, number[]>();
|
||||
for (const token of tokens) {
|
||||
if (token.type === "color") {
|
||||
if (token.type === "color" && renderColor) {
|
||||
const color = token.color;
|
||||
if (color) {
|
||||
const colorCode = __getColorCode(color);
|
||||
@@ -629,7 +629,7 @@ function renderColorTokens(tokens: ColorToken[]): string {
|
||||
}
|
||||
}
|
||||
}
|
||||
text.push("\x1b[0m"); // FINALLY END ALL COLOR
|
||||
renderColor && text.push("\x1b[0m"); // FINALLY END ALL COLOR
|
||||
return text.join("");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user