Converts a JavaScript value to ANSI-colored terminal output Convenience function that parses the value and paints it with ANSI codes
The value to convert to ANSI output
Optional
Optional configuration for highlighting
String with ANSI color codes for terminal display
const data = { name: "Alice", age: 30 };const ansi = ansi_from_value(data);console.log(ansi); // Outputs colorized in terminal Copy
const data = { name: "Alice", age: 30 };const ansi = ansi_from_value(data);console.log(ansi); // Outputs colorized in terminal
const arr = [1, 2, 3, "hello", true];const ansi = ansi_from_value(arr, { palette: palettes.bold.dark });console.log(ansi); // Outputs with ANSI color codes Copy
const arr = [1, 2, 3, "hello", true];const ansi = ansi_from_value(arr, { palette: palettes.bold.dark });console.log(ansi); // Outputs with ANSI color codes
Converts a JavaScript value to ANSI-colored terminal output Convenience function that parses the value and paints it with ANSI codes