-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbanner.ts
More file actions
30 lines (27 loc) · 1.02 KB
/
banner.ts
File metadata and controls
30 lines (27 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import chalk from "chalk";
const LINES = [
// Pagga on https://www.asciiart.eu/text-to-ascii-art
// Box elements from https://www.compart.com/en/unicode/block/U+2500
"╭─────────────────────────╮",
"│░█▀▀░█▀▀░█▀▄░█▀▄░▀█▀░█▀▀░│",
"│░█▀▀░█▀▀░█▀▄░█▀▄░░█░░█░░░│",
"│░▀░░░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀▀░│",
"╰─────────────────────────╯",
];
export function getBlockComment() {
return (
"/**\n" +
["This file was generated by", ...LINES, "Powered by napi.rs"]
.map((line) => ` * ${line}`)
.join("\n") +
"\n */"
);
}
export function printBanner() {
console.log(
LINES.map((line, lineNumber, lines) => {
const ratio = lineNumber / lines.length;
return chalk.rgb(Math.round(250 - 100 * ratio), 0, 0)(line);
}).join("\n")
);
}