Colorize Terminal Output in Larzscript
Add ANSI colors to terminal output, with automatic NO_COLOR support so piped output stays clean.
Every color function returns plain text once color.set_enabled(false) is called (or NO_COLOR is set in the environment) - a disabled run is genuinely pipe-safe, not just visually blank.
larzscript pkg install color
Code
import "color" as c
print(c.green("ok"), c.red("error"), c.bold(c.cyan("title")))Output
[32mok[0m [31merror[0m [1m[36mtitle[0m[0m
Related
larzcolorANSI terminal color→Build a CLI Tool with Subcommands in LarzscriptBuild a real command-line tool with named subcommands and auto-generated help, the shape every larzscript-* showcase app in this ecosystem uses.→Parse Command-Line Arguments in LarzscriptParse --flag=value pairs and positional arguments out of argv, without a full CLI framework.→Read a File Line by Line in LarzscriptRead a text file's contents and split it into lines - the everyday first step of any script that processes a file.→