httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
33.22k stars 3.67k forks source link

Use `$JQ_COLORS` to color JSON output #1095

Open bl-ue opened 3 years ago

bl-ue commented 3 years ago

Checklist


What enhancement would you like to see?

Use $JQ_COLORS if set to color JSON output.

What problem does it solve?

I've configured jq to output colors via $JQ_COLORS the way I like (1;30:1;33:1;33:1;31:1;32:1;39:1;39), and it would be super if http automatically detected that and used them.

isidentical commented 2 years ago

This is actually possible without any burden for us. HTTPie uses pygments style's to highlight certain parts of the request and response, and if you implement and register a custom style that processes JQ_COLORS and use it as the style, you can directly use it from HTTPie by telling it to look for it --style=my-custom-style.

Whether such a theme should go into the core or not is a product decision, cc: @jakubroztocil. I'd personally say it would be an OK addition.