jqlang / jq

Command-line JSON processor
https://jqlang.github.io/jq/
Other
30.23k stars 1.57k forks source link

"color for object keys" from JQ_COLORS doesn't seem to be respected #3115

Closed ksowa closed 4 months ago

ksowa commented 4 months ago

Describe the bug When I tried to change color for object keys by setting the 8th item in the JQ_COLORS variable, it didn't make any difference.

Manual page: https://jqlang.github.io/jq/manual/v1.7/#colors

To Reproduce Create a test.json file with the following contents:

{
  "field_1": true,
  "field_2": false,
  "field_3": 123456,
  "field_4": "abc",
  "field_5": ["a", 1],
  "field_6": null
}

Run a few commands, using different setting for the color for object keys value. For example:

cat test.json | JQ_COLORS='1;90:0;35:0;35:0;36:0;32:1;35:1;35;1:30' jq

cat test.json | JQ_COLORS='1;90:0;35:0;35:0;36:0;32:1;35:1;35;0:35' jq

cat test.json | JQ_COLORS='1;90:0;35:0;35:0;36:0;32:1;35:1;35;1:90' jq

The outcome is always the same - the object keys are blue. image

Expected behavior I would expect the color of object keys to change when I change the 8th color in the JQ_COLORS variable.

All the other colors change as expected.

Environment (please complete the following information):

itchyny commented 4 months ago

What's the output of jq --version

ksowa commented 4 months ago

@itchyny I edited my report, as initially I put a wrong version number.

jq-1.6
itchyny commented 4 months ago

The color for object keys in JQ_COLORS was implemented in 1.7. Please update jq version.

ksowa commented 4 months ago

I just updated to jq-1.7.1-51-gc127616 and it works as expected.

Thank you for your help!