0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

fix(repl): Fix undefined result colour in cmd (#10964)

* fix(repl): Fix `undefined` result colour.
* Remove `dim`. Use `gray` instead since it works in cmd.
This commit is contained in:
David Sherret 2021-06-14 16:34:44 -04:00 committed by GitHub
parent f4728e26fe
commit 0acd0602bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -55,10 +55,6 @@
return run(str, code(35, 39));
}
function dim(str) {
return run(str, code(2, 22));
}
// https://github.com/chalk/ansi-regex/blob/2b56fb0c7a07108e5b54241e8faec160d393aedb/index.js
const ANSI_PATTERN = new RegExp(
[
@ -87,7 +83,6 @@
white,
gray,
magenta,
dim,
stripColor,
maybeColor,
};

View file

@ -437,7 +437,7 @@
const green = maybeColor(colors.green, inspectOptions);
const yellow = maybeColor(colors.yellow, inspectOptions);
const dim = maybeColor(colors.dim, inspectOptions);
const gray = maybeColor(colors.gray, inspectOptions);
const cyan = maybeColor(colors.cyan, inspectOptions);
const bold = maybeColor(colors.bold, inspectOptions);
const red = maybeColor(colors.red, inspectOptions);
@ -450,8 +450,8 @@
return yellow(Object.is(value, -0) ? "-0" : `${value}`);
case "boolean": // booleans are yellow
return yellow(String(value));
case "undefined": // undefined is dim
return dim(String(value));
case "undefined": // undefined is gray
return gray(String(value));
case "symbol": // Symbols are green
return green(maybeQuoteSymbol(value));
case "bigint": // Bigints are yellow
@ -583,7 +583,7 @@
level,
inspectOptions,
) {
const dim = maybeColor(colors.dim, inspectOptions);
const gray = maybeColor(colors.gray, inspectOptions);
const options = {
typeName: "Array",
displayName: "",
@ -599,7 +599,7 @@
}
const emptyItems = i - index;
const ending = emptyItems > 1 ? "s" : "";
return dim(`<${emptyItems} empty item${ending}>`);
return gray(`<${emptyItems} empty item${ending}>`);
} else {
return inspectValueWithQuotes(val, level, inspectOptions);
}