Skip to content

Commit

Permalink
fix(fancy): improve colors
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Apr 11, 2023
1 parent 474f82f commit 99c2a4f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/reporters/fancy.ts
Expand Up @@ -9,23 +9,29 @@ import BasicReporter from "./basic";
export const TYPE_COLOR_MAP: { [k in LogType]?: string } = {
info: "cyan",
fail: "red",
success: "green",
ready: "green",
start: "yellow",
};

export const LEVEL_COLOR_MAP: { [k in LogLevel]?: string } = {
0: "red",
1: "yellow",
2: "white",
3: "white",
};

const unicode = isUnicodeSupported();
const s = (c: string, fallback: string) => (unicode ? c : fallback);
const TYPE_ICONS = {
const TYPE_ICONS: { [k in LogType]?: string } = {
error: s("βœ–", "Γ—"),
fatal: s("βœ–", "Γ—"),
ready: s("βœ”", "√"),
warn: s("⚠", "β€Ό"),
info: s("β„Ή", "i"),
success: s("βœ”", "√"),
debug: s("βš™", "D"),
trace: s("⬆", "T"),
trace: s("β†’", "β†’"),
fail: s("βœ–", "Γ—"),
start: s("βš™", "S"),
log: "",
};

Expand Down Expand Up @@ -61,6 +67,7 @@ export default class FancyReporter extends BasicReporter {
typeof (TYPE_ICONS as any)[logObj.type] === "string"
? (TYPE_ICONS as any)[logObj.type]
: (logObj as any).icon || logObj.type;

return _type ? getColor(typeColor)(_type) : "";
}

Expand Down

0 comments on commit 99c2a4f

Please sign in to comment.