8000 fix(fancy): improve colors · unjs/consola@99c2a4f · GitHub
[go: up one dir, main page]

Skip to content

Commit 99c2a4f

Browse files
committed
fix(fancy): improve colors
1 parent 474f82f commit 99c2a4f

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/reporters/fancy.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@ import BasicReporter from "./basic";
99
export const TYPE_COLOR_MAP: { [k in LogType]?: string } = {
1010
info: "cyan",
1111
fail: "red",
12+
success: "green",
13+
ready: "green",
14+
start: "yellow",
1215
};
1316

1417
export const LEVEL_COLOR_MAP: { [k in LogLevel]?: string } = {
1518
0: "red",
1619
1: "yellow",
17-
2: "white",
18-
3: "white",
1920
};
2021

2122
const unicode = isUnicodeSupported();
2223
const s = (c: string, fallback: string) => (unicode ? c : fallback);
23-
const TYPE_ICONS = {
24+
const TYPE_ICONS: { [k in LogType]?: string } = {
25+
error: s("✖", "×"),
26+
fatal: s("✖", "×"),
27+
ready: s("✔", "√"),
28+
warn: s("⚠", "‼"),
2429
info: s("ℹ", "i"),
2530
success: s("✔", "√"),
2631
debug: s("⚙", "D"),
27-
trace: s("", "T"),
32+
trace: s("", ""),
2833
fail: s("✖", "×"),
34+
start: s("⚙", "S"),
2935
log: "",
3036
};
3137

@@ -61,6 +67,7 @@ export default class FancyReporter extends BasicReporter {
6167
typeof (TYPE_ICONS as any)[logObj.type] === "string"
6268
? (TYPE_ICONS as any)[logObj.type]
6369
: (logObj as any).icon || logObj.type;
70+
6471
return _type ? getColor(typeColor)(_type) : "";
6572
}
6673

0 commit comments

Comments
 (0)
0