66 lines
1.9 KiB
TypeScript
Executable File
66 lines
1.9 KiB
TypeScript
Executable File
#!/usr/bin/env runts -- --allow-import --allow-net
|
|
|
|
import {fetchDataWithTimeout, term,} from "https://script.hatter.ink/@33/deno-commons-mod.ts";
|
|
|
|
function printColors(colors: string[], prefix: string, suffix: string) {
|
|
const termOutputs: string[] = [];
|
|
for (const color of colors) {
|
|
termOutputs.push(
|
|
term.auto(
|
|
`[${prefix}${color}${suffix}][[[[${prefix}${color}${suffix}] Hello World! [/${prefix}${color}${suffix}]]]][/] `,
|
|
),
|
|
);
|
|
}
|
|
console.log(termOutputs.join(" "));
|
|
}
|
|
|
|
async function main() {
|
|
const colors: string[] = [
|
|
"black",
|
|
"red",
|
|
"green",
|
|
"yellow",
|
|
"blue",
|
|
"pink",
|
|
"cyan",
|
|
"white",
|
|
];
|
|
try {
|
|
const denoCommonsModResponse = await fetchDataWithTimeout(
|
|
"https://hatter.ink/s/deno-commons-mod.ts",
|
|
);
|
|
const denoCommonsMod = await denoCommonsModResponse.json();
|
|
const denoCommonsModUrl = denoCommonsMod.data["script-url"];
|
|
console.log(
|
|
term.auto(
|
|
`[bg_white][green][bold]import {term} from "${denoCommonsModUrl}";\n`,
|
|
),
|
|
);
|
|
} catch (e) {
|
|
// IGNORE
|
|
}
|
|
|
|
printColors(colors, "", "");
|
|
console.log();
|
|
printColors(colors, "", "_bright");
|
|
console.log();
|
|
printColors(colors, "bg_", "");
|
|
console.log();
|
|
printColors(colors, "bg_", "_bright");
|
|
console.log();
|
|
console.log(
|
|
term.auto(
|
|
"[bg_black][white][bold][[[[bg_black][white][bold]Bold, white and black background [/][/][/]]]][/][/][/] plaintext",
|
|
),
|
|
);
|
|
console.log(
|
|
term.auto(
|
|
"[black][bg_white][bold][[[[black][bg_white][bold]Bold, black and white background [///]]]][///] plaintext",
|
|
),
|
|
);
|
|
}
|
|
await main();
|
|
|
|
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T155627+08:00.MEUCIQCNvK8MGUysW3ViadvM
|
|
// cPl3F2YdRX11n4/JSx1tGTKN6QIgQpqebkvgs09wnyjuz3OvhOq3emYvAomjhoSxPGShzCw=
|