-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set field color using JQ_COLORS #1791
Conversation
This is a drive-by change; I believe the colon character is better described as a separator than a delimiter within JQ_COLORS.
For some reason, the ANSI escape codes for fields were written as `34;1` ("blue", then "bright"), whereas for all other types, the order was "effect" first, "color" second. This changes the order for fields to `1;34` for consistency, matching the current code.
Interesting. Obviously there is no use for this new "kind" other than as an index into the array of colors. I'll think about it. Thanks for your contribution! |
Cool. Please don't hesitate to let me know if you see changes that you think would make sense. |
@nicowilliams , would you be willing to merge an updated version of this patch or even #1977? |
I'm attaching a patch that's a updated version of this PR for anyone that builds jq themselves. Thanks, @haguenau, for the original code. jq-src-JQ_COLORS-field-color.patch.txt EDIT: I noticed that in cf61515, jq.1.prebuilt was not updated with the new default scheme. |
is this abandoned? |
Depends on what you mean by abandoned. I'm still using this patch, and the last time I synchronized my copy of jq with the upstream repo (December), the patch still applied cleanly, so I haven't needed to post any updates here. |
I see commits on the repo as recently as a month and a half ago... guessing the dev's are just busy / this isn't a high priority for them. I'm not familar with travis builds but I see that it has something flagged for:
It could be something as simple as that holding things back. Anyway, I hope folks are able to make it happen too... can't stand the hard-to-read dark blue key/property names on my terminal. Even if the default was a bright purple, that would at least have decent contrast on light and dark backgrounds. Obviously customizing would be better but I probably wouldn't have bothered to look this up / subscribe to the ticket and PR if the defaults were more reasonable :-) Guess it's back to |
I have not followed jq development very closely since submitting this pull request two years ago. I must admit I do not fully understand nicowilliam's reasons for having to think more about this; I assume the change is somehow unclean. If there is interest, I would be happy to look into reworking the change so that it applies successfully to the current code. |
I would, too, be very interested in hearing counter-arguments against this. The hard-coded field color is very difficult to read on a dark background, and dark backgrounds are pretty common in what I would assume jq's user base is. Changing the field color is also something quite a few people request in https://stackoverflow.com/questions/51338701/how-do-i-customize-the-colors-used-by-jq-c |
Really looking into getting this merge, Can I offer any help with it?. |
Added to the next release milestone. Needs rebasing though. |
I'll open a PR later today with my latest version of the patch. |
I'll open a PR later today with my latest version of the patch.
Much appreciated. Given how old this pull request is, I expect a lot
of changes would be needed to make it up to date, so I am very happy
to see you offer to take care of this.
|
I've opened #2638. |
Taking a careful look into this patch, I finally understand why this is hard to merge. This patch adds |
…qlang#2638) Co-authored-by: David Haguenauer <ml@kurokatta.org> Co-authored-by: Eric Pruitt <eric.pruitt@gmail.com>
…qlang#2638) Co-authored-by: David Haguenauer <ml@kurokatta.org> Co-authored-by: Eric Pruitt <eric.pruitt@gmail.com>
…qlang#2638) Co-authored-by: David Haguenauer <ml@kurokatta.org> Co-authored-by: Eric Pruitt <eric.pruitt@gmail.com>
This should address #1739.
As far as I can tell, this works and passes the test suite (which I updated to test this specific addition). There is a chance that the code changes are not perfect; for example I'm not sure how much sense it makes to have introduced an enum member
JV_KIND_FIELD
for this (although it keeps the code mostly regular).