Skip to content
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

Make field colors configurable #2638

Closed
wants to merge 1 commit into from
Closed

Make field colors configurable #2638

wants to merge 1 commit into from

Conversation

ericpruitt
Copy link
Contributor

Allow object key colors to be configured with the "JQ_COLORS" environment variable. This is a updated version of a GitHub pull request created by David
Haguenauer
. Since the prebuilt manual already needed to be updated, this change also fixes in omission in cf61515 in which "39" in "JQ_COLORS" should have been replaced with "37".

Allow object key colors to be configured with the "JQ_COLORS"
environment variable. This is a updated version of a [GitHub pull
request created by David
Haguenauer](#1791). Since the
prebuilt manual already needed to be updated, this change also fixes in
omission in <cf61515> in which
"39" in "JQ_COLORS" should have been replaced with "37".
@ericpruitt
Copy link
Contributor Author

I also wrote a script called jqcolors that's analagous to dircolors that I could include in a separate PR if you'd accept it: https://github.com/ericpruitt/emus/blob/master/scripts/jqcolors.

Example file:

~$ cat .jqcolors
STRING  0           # Default
ARRAY   0           # Default
OBJECT  0           # Default
FIELD   1;37        # Bold White

# XTerm colors are used for these tokens to make the text bright -- having the
# red, green and/or blue channels maxed out -- without being bold.
NULL    0;38;5;226  # Yellow
FALSE   0;38;5;196  # Red
TRUE    0;38;5;46   # Green
NUMBER  0;38;5;201  # Magenta

@itchyny itchyny added this to the 1.7 release milestone Jun 29, 2023
@@ -293,20 +293,44 @@ if [ "$($VALGRIND $Q $JQ -n '{"a":"xyz"} | halt_error(1)' 2>&1)" != '{"a":"xyz"}
fi

# Check $JQ_COLORS
## Default colors, null input
$JQ -Ccn . > $d/color
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prepend JQ_COLORS= this line and L307. make check fails when exporting the environment variable.

@@ -13,7 +13,8 @@ typedef enum {
JV_KIND_NUMBER,
JV_KIND_STRING,
JV_KIND_ARRAY,
JV_KIND_OBJECT
JV_KIND_OBJECT,
JV_KIND_FIELD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #1791 (comment).

itchyny added a commit to itchyny/jq that referenced this pull request Jul 12, 2023
itchyny added a commit to itchyny/jq that referenced this pull request Jul 12, 2023
itchyny added a commit to itchyny/jq that referenced this pull request Jul 12, 2023
itchyny added a commit to itchyny/jq that referenced this pull request Jul 12, 2023
itchyny added a commit to itchyny/jq that referenced this pull request Jul 12, 2023
nicowilliams pushed a commit that referenced this pull request Jul 18, 2023
Co-authored-by: David Haguenauer <[email protected]>
Co-authored-by: Eric Pruitt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants