Closed jprupp closed 1 year ago
Does the information provided at the following link help?
https://stackoverflow.com/questions/51338701/how-do-i-customize-the-colors-used-by-jq-c
Yes, I can customize colours both in jq
itself and the terminal if I need to. The bug report is to encourage fixing default settings rather than dealing with the problem as experienced on my particular setup.
TLDR If anyone's reading this, setting this environment variable will switch your black bold invisible null
to a red non-bold one:
export JQ_COLORS='0;31:0;39:0;39:0;39:0;32:1;39:1;39'
The part affecting this is the initial characters 0;31
which translates to non-bold;red
. change 0;
to 1;
for boldness, change 31
to 37
to make it white and non intrusive.
Regardless, I also think jq should identify default colors and provide sane defaults. Unfortunate this has to be done manually.
I can confirm that the null does not show up in Alacritty's default colorscheme and the Gruvbox colorscheme in Alacritty and Neovim's internal terminal when using the Gruvbox theme.
I'm seeing the same issue on Kitty - Terminal Emulator.
lol, I was about to make a issue asking why jq prints a empty string to terminal but prints "null" if I have it in a pipe/subshell
Same here. Although I've been working with Jq for a while, it's only now that I stumbled upon this output where I knew that timestamp
is null
:
I was confused whether this is an issue with Jq or my terminal. I didn't even think that this could be an issue with the default colour because I couldn't imagine that someone would choose black for output in terminals which traditionally have a dark background.
Does non-bold-bright-foreground-black (90) look ok with default colors for kitty, alacritty and neovim?
Can try with:
echo -e '\0x1b[90mnull\0x1b[0m'
# or
JQ_COLORS='0;90:0;39:0;39:0;39:0;32:1;39:1;39' jq -n .
That is was gojq uses. For iterm2 and macOS Terminal.app it looks dark greyish.
0;90
looks fine for me (Ubuntu 22.04 and Terminator):
Side note:
The default value mentioned in the documentation seems to be outdated. If I set JQ_COLORS
to that one containing ;37
, the white is slightly weaker than without setting JQ_COLORS
. The white didn't change however when I used your example with ;39
.
❯ jq --version
jq-1.6
Found this while poking around https://github.com/jqlang/jq/pull/2032 it used to be 39
Ah, I see, 1.6 has been released two years prior to that change and I didn't notice that I was reading the development version documentation. However, the documentation for 1.6 also mentions 37.
In any case thanks for clarifying!
Description On Fedora 30, using the default settings on Gnome Terminal (dark background, Tango colorscheme),
null
values are almost invisible.To Reproduce Install a vanilla Fedora 30 distribution. Install
jq
from Fedora repositories:dnf install jq
. Display a JSON document with anull
value in it. See how thenull
value text is barely visible (dark on dark background).Expected behavior Every value in the JSON document printed by
jq
should be clearly visible on any Linux distribution, especially popular ones, and especially using default settings.Environment