@getjack/jack 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/output.ts +6 -3
package/package.json
CHANGED
package/src/lib/output.ts
CHANGED
|
@@ -148,16 +148,19 @@ export function celebrate(title: string, lines: string[]): void {
|
|
|
148
148
|
const gradient = "░".repeat(innerWidth);
|
|
149
149
|
const space = " ".repeat(innerWidth);
|
|
150
150
|
|
|
151
|
-
|
|
151
|
+
// Center text based on visual length, then apply colors
|
|
152
|
+
const center = (text: string, applyBold = false) => {
|
|
152
153
|
const left = Math.floor((innerWidth - text.length) / 2);
|
|
153
|
-
|
|
154
|
+
const right = innerWidth - text.length - left;
|
|
155
|
+
const centered = " ".repeat(left) + text + " ".repeat(right);
|
|
156
|
+
return applyBold ? centered.replace(text, bold + text + reset + purple) : centered;
|
|
154
157
|
};
|
|
155
158
|
|
|
156
159
|
console.error("");
|
|
157
160
|
console.error(` ${purple}╔${bar}╗${reset}`);
|
|
158
161
|
console.error(` ${purple}║${fill}║${reset}`);
|
|
159
162
|
console.error(` ${purple}║${space}║${reset}`);
|
|
160
|
-
console.error(` ${purple}║${center(
|
|
163
|
+
console.error(` ${purple}║${center(title, true)}║${reset}`);
|
|
161
164
|
console.error(` ${purple}║${space}║${reset}`);
|
|
162
165
|
for (const line of lines) {
|
|
163
166
|
console.error(` ${purple}║${center(line)}║${reset}`);
|