update term color

This commit is contained in:
2026-02-08 15:56:03 +08:00
parent 4428a5e3fc
commit 052ac6612b
2 changed files with 23 additions and 7 deletions

View File

@@ -256,12 +256,12 @@
},
"term-color.ts": {
"script_name": "term-color.ts",
"script_length": 1472,
"script_sha256": "64523ef7952cc9e189b04605677e2e03193b9435b9d171423d590fd6a37280e3",
"script_length": 2040,
"script_sha256": "19bfc6d98fd3e6eee305b30a89904d4c5d8961bc203e84e0ce00c35485372d26",
"script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/term-color.ts",
"single_script_file": true,
"publish_time": 1770533214194,
"update_time": 1770536826085
"update_time": 1770537359527
},
"tree.ts": {
"script_name": "tree.ts",

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env runts -- --allow-import
#!/usr/bin/env runts -- --allow-import --allow-net
import {term} from "https://script.hatter.ink/@33/deno-commons-mod.ts";
import { term } from "https://script.hatter.ink/@33/deno-commons-mod.ts";
import { fetchDataWithTimeout } from "../libraries/deno-commons-mod.ts";
function printColors(colors: string[], prefix: string, suffix: string) {
const termOutputs: string[] = [];
@@ -25,6 +26,21 @@ async function main() {
"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");
@@ -46,5 +62,5 @@ async function main() {
}
await main();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T154653+08:00.MEUCIQCt2qj/3lPKwhX8n5ID
// jvkItXyST6mG1/j3fcUHybaePQIgAM4ErXInKntZU3DvmuX8szEFXIcFN1W3+zYLzPuYywk=
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T155509+08:00.MEUCIEkRx6ftytYOS1NOOi/C
// 5k1uznr7juyMmOMq/11nkyWIAiEA8tGnRCDfOyaQriwMSjxfO4tTm2xfxbcUbvJfmy/HAso=