diff --git a/script-meta-v2.json b/script-meta-v2.json index 8b39ce4..fe99200 100644 --- a/script-meta-v2.json +++ b/script-meta-v2.json @@ -247,12 +247,21 @@ }, "ssh.ts": { "script_name": "ssh.ts", - "script_length": 6865, - "script_sha256": "ea4b327867b5b22269a0bb063df0ff475c90a876f1d8a4ab5d3fd5417ef01ba6", + "script_length": 7011, + "script_sha256": "30095c6f3f1ad698a0be6254c564bd6a5a5404ed7ae9eef0c2491c2640770f8a", "script_full_url": "https://git.hatter.ink/hatter/ts-scripts/raw/branch/main/single-scripts/ssh.ts", "single_script_file": true, "publish_time": 1768111677531, - "update_time": 1770400550100 + "update_time": 1770533214189 + }, + "term-color.ts": { + "script_name": "term-color.ts", + "script_length": 1284, + "script_sha256": "986933a2d8457c58b7db2ce20189a7a39815c87ea4729fefe9cfe04d5505f729", + "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 }, "tree.ts": { "script_name": "tree.ts", diff --git a/single-scripts/term-color.ts b/single-scripts/term-color.ts new file mode 100755 index 0000000..95a8d2f --- /dev/null +++ b/single-scripts/term-color.ts @@ -0,0 +1,42 @@ +#!/usr/bin/env runts -- --allow-import + +import {term} from "https://script.hatter.ink/@32/deno-commons-mod.ts"; + +function printColors(colors: string[], prefix: string, suffix: string) { + const termOutputs = []; + 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 = [ + "black", + "red", + "green", + "yellow", + "blue", + "pink", + "cyan", + "white", + ]; + 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]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=