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

Default color of jq is indistinguishable under Solarized Light background #2903

Closed
taoky opened this issue Sep 18, 2023 · 8 comments · Fixed by #2904
Closed

Default color of jq is indistinguishable under Solarized Light background #2903

taoky opened this issue Sep 18, 2023 · 8 comments · Fixed by #2904
Milestone

Comments

@taoky
Copy link
Contributor

taoky commented Sep 18, 2023

Describe the bug
Since jq 1.7, its default color is very hard to read when using Solarized Light.

To Reproduce

Tilix 1.9.5, with Solarized Light color scheme.

> echo '{"a": 1, "b": "b", "c": [1,2,3,4,5]}' | jq .

image

Expected behavior

Clean output like jq 1.6.

Environment (please complete the following information):

  • OS and Version: Arch Linux
  • jq version 1.7

Additional context

This may be caused by #2824.

@itchyny
Copy link
Contributor

itchyny commented Sep 18, 2023

#2824 does not change the color of numbers. Could you share the screenshot of the same command with jq 1.6?

@taoky
Copy link
Contributor Author

taoky commented Sep 18, 2023

jq 1.6:

image

I'm also bisecting jq's code and I would comment here if I have found out that commit.

@taoky
Copy link
Contributor Author

taoky commented Sep 18, 2023

It's 07b18a3.

@taoky
Copy link
Contributor Author

taoky commented Sep 18, 2023

This works correctly within Solarized Light:

> echo '{"a": 1, "b": "b", "c": [1,2,3,4,5]}' | JQ_COLORS="1;30:0;39:0;39:0;39:0;32:1;39:1;39" jq .

(Screenshot is the same as jq 1.6).

Guess that this commit should be reverted...

@taoky
Copy link
Contributor Author

taoky commented Sep 18, 2023

I'm trying to revert this commit, and it seems that directly changes "37" to "39" will make "null" indistinguishable under dark background. "null" also shows badly in released jq 1.7 under Solarized Dark.

@nicowilliams
Copy link
Contributor

It might be nice to have an env var that names the terminal's color scheme so we can pick a suitable color scheme.

@taoky
Copy link
Contributor Author

taoky commented Sep 19, 2023

It might be nice to have an env var that names the terminal's color scheme so we can pick a suitable color scheme.

It's a bit mess as there's no universal convention about getting color scheme: https://unix.stackexchange.com/questions/245378/common-environment-variable-to-set-dark-or-light-terminal-background.

@nicowilliams
Copy link
Contributor

It might be nice to have an env var that names the terminal's color scheme so we can pick a suitable color scheme.

It's a bit mess as there's no universal convention about getting color scheme: https://unix.stackexchange.com/questions/245378/common-environment-variable-to-set-dark-or-light-terminal-background.

Using COLORFGBG sounds pretty good to me. I'm not too keen on OSC 11 because that would be the first instance in which jq communicates with the terminal, and I'd rather not have that complexity since we can leave it to shell-term-background to set COLORFGBG where OSC 11 is supported and tell people to use that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants