This commit is contained in:
2026-02-08 14:49:30 +08:00
parent 8c3014394f
commit 3cfce3ef87
2 changed files with 17 additions and 9 deletions

View File

@@ -256,12 +256,12 @@
},
"term-color.ts": {
"script_name": "term-color.ts",
"script_length": 1284,
"script_sha256": "986933a2d8457c58b7db2ce20189a7a39815c87ea4729fefe9cfe04d5505f729",
"script_length": 1380,
"script_sha256": "3ece88b65555499245a670b03002a3edd5d957f88151863bea0d829a75f92cb9",
"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": 1770533214194
"update_time": 1770533366713
},
"tree.ts": {
"script_name": "tree.ts",

View File

@@ -3,7 +3,7 @@
import {term} from "https://script.hatter.ink/@32/deno-commons-mod.ts";
function printColors(colors: string[], prefix: string, suffix: string) {
const termOutputs = [];
const termOutputs: string[] = [];
for (const color of colors) {
termOutputs.push(
term.auto(
@@ -15,7 +15,7 @@ function printColors(colors: string[], prefix: string, suffix: string) {
}
async function main() {
const colors = [
const colors: string[] = [
"black",
"red",
"green",
@@ -33,10 +33,18 @@ async function main() {
console.log();
printColors(colors, "bg_", "_bright");
console.log();
console.log(term.auto('[bg_black][white][bold]Bold, white and black background [/][/][/]'));
console.log(term.auto('[black][bg_white][bold]Bold, black and white background [/][/][/]'));
console.log(
term.auto(
"[bg_black][white][bold]Bold, white and black background [/][/][/]",
),
);
console.log(
term.auto(
"[black][bg_white][bold]Bold, black and white background [/][/][/]",
),
);
}
await main();
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T144636+08:00.MEUCIQCyWJ2Yiijq3QYzuGXC
// uF1MfCW1yjFC5LmxDXQwGs8efgIgD6Xfh/4jUoDMjhRhp2itj9juT4PkGkP2u+9AhBZo1hY=
// @SCRIPT-SIGNATURE-V1: yk-r1.ES256.20260208T144919+08:00.MEYCIQCSlSgTG6QYjn33Q5EH
// mGh2Fgzhn6QZVFCSKSJYcJrvxwIhAJeu9a64omxuy3aSMLggr7aWnTpDNNWq1dIM8qvjFNQ9