Colors
The colors module is a simple and tiny chainable wrapper around deno’s std colors module and works similar to node’s chalk module.
import { colors } from "https://deno.land/x/cliffy@v1.0.0-rc.4/ansi/colors.ts";
console.log(
colors.bold.underline.rgb24("Welcome to Deno.Land!", 0xff3333),
);
Copy
deno run https://deno.land/x/cliffy@v1.0.0-rc.4/examples/ansi/colors.ts
Copy
Themes
You can create your own re-usable themes just by storing your styles into a variable.
import { colors } from "https://deno.land/x/cliffy@v1.0.0-rc.4/ansi/colors.ts";
// Define theme colors.
const error = colors.bold.red;
const warn = colors.bold.yellow;
const info = colors.bold.blue;
// Use theme colors.
console.log(error("[ERROR]"), "Some error!");
console.log(warn("[WARN]"), "Some warning!");
console.log(info("[INFO]"), "Some information!");
// Override theme colors.
console.log(error.underline("[ERROR]"), "Some error!");
console.log(warn.underline("[WARN]"), "Some warning!");
console.log(info.underline("[INFO]"), "Some information!");
Copy
deno run https://deno.land/x/cliffy@v1.0.0-rc.4/examples/ansi/color_themes.ts
Copy