Converts a JSON or JavaScript string to ANSI-colored terminal output Convenience function that parses the string and paints it with ANSI codes
The string to convert to ANSI output (JSON or JavaScript literal)
Optional
Optional configuration for highlighting
String with ANSI color codes for terminal display
const json = '{"name": "Alice", "age": 30}';const ansi = ansi_from_string(json);console.log(ansi); // Outputs colorized in terminal Copy
const json = '{"name": "Alice", "age": 30}';const ansi = ansi_from_string(json);console.log(ansi); // Outputs colorized in terminal
const arr = '[1, 2, 3, "hello", true]';const ansi = ansi_from_string(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_string(arr, { palette: palettes.bold.dark });console.log(ansi); // Outputs with ANSI color codes
Converts a JSON or JavaScript string to ANSI-colored terminal output Convenience function that parses the string and paints it with ANSI codes