From 5a01d53358e7d5bc5497f66ca40402cf8af2808a Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Tue, 11 Apr 2023 02:40:53 +0200 Subject: [PATCH] refactor(fancy): better start color and icon --- examples/prompt.ts | 4 ++++ examples/spinner.ts | 9 +++++++++ src/reporters/fancy.ts | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100755 examples/spinner.ts diff --git a/examples/prompt.ts b/examples/prompt.ts index 80bf0957..68bb0308 100755 --- a/examples/prompt.ts +++ b/examples/prompt.ts @@ -28,6 +28,10 @@ async function main() { { value: "gh-action", label: "GitHub Action" }, ], }); + + await consola.start("Creating project..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + await consola.success("Project created!"); } main(); diff --git a/examples/spinner.ts b/examples/spinner.ts new file mode 100755 index 00000000..48d3d12e --- /dev/null +++ b/examples/spinner.ts @@ -0,0 +1,9 @@ +import { consola } from "./utils"; + +async function main() { + await consola.start("Creating project..."); + await new Promise((resolve) => setTimeout(resolve, 1000)); + await consola.success("Project created!"); +} + +main(); diff --git a/src/reporters/fancy.ts b/src/reporters/fancy.ts index b9f9858e..9ce685d5 100644 --- a/src/reporters/fancy.ts +++ b/src/reporters/fancy.ts @@ -11,7 +11,7 @@ export const TYPE_COLOR_MAP: { [k in LogType]?: string } = { fail: "red", success: "green", ready: "green", - start: "yellow", + start: "magenta", }; export const LEVEL_COLOR_MAP: { [k in LogLevel]?: string } = { @@ -31,7 +31,7 @@ const TYPE_ICONS: { [k in LogType]?: string } = { debug: s("⚙", "D"), trace: s("→", "→"), fail: s("✖", "×"), - start: s("⚙", "S"), + start: s("◐", "o"), log: "", };