jq.node icon indicating copy to clipboard operation
jq.node copied to clipboard

Change default color behaviour

Open jayeheffernan opened this issue 6 years ago • 1 comments

Hi there, awesome library! Much more intuitive than jq for a JS developer like myself. I have a feature request to make it a bit more convenient/intuitive still.

I think that the default behaviour of the color options should be changed. You have mentioned this yourself here. The colorized output can be annoying when using jq.node as part of a pipeline in scripts. Personally, my main use case is for filtering JSON data that I'm editing in Vim, and the color codes get in my way each time I try to do this (until I figure out again what option I need to use).

The best option would be to use something like supports-color to guess whether the output should be colorized (but if an explicit option value is given it should override this guess). colors.js and chalk both work this way, for example. This way it can automatically handle adding nice colors for an interactive terminal session, and omitting them in a script or pipeline.

Thanks!

jayeheffernan avatar Nov 14 '19 02:11 jayeheffernan

Indeed, I agree, please open a PR along with some tests and I will merge it :+1:

FGRibreau avatar Dec 19 '19 14:12 FGRibreau