Skip to content

Commit a692060

Browse files
itchynynicowilliams
authored andcommitted
Change the default color of null to Bright Black
1 parent f94a9d4 commit a692060

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

NEWS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Full commit log can be found at <https://github.com/jqlang/jq/compare/jq-1.6...j
2626
- Make object key color configurable using `JQ_COLORS` environment variable. @itchyny @haguenau @ericpruitt #2703
2727

2828
```sh
29-
# this would make "field" yellow (33, the last value)
30-
$ JQ_COLORS="1;30:0;37:0;37:0;37:0;32:1;37:1;37:1;33" ./jq -n '{field: 123}'
29+
# this would make "field" bold yellow (`1;33`, the last value)
30+
$ JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;33" ./jq -n '{field: 123}'
3131
{
3232
"field": 123
3333
}

docs/content/manual/manual.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3656,7 +3656,7 @@ sections:
36563656
- color for object keys
36573657
36583658
The default color scheme is the same as setting
3659-
`JQ_COLORS="1;30:0;37:0;37:0;37:0;32:1;37:1;37:1;34"`.
3659+
`JQ_COLORS="0;90:0;37:0;37:0;37:0;32:1;37:1;37:1;34"`.
36603660
36613661
This is not a manual for VT100/ANSI escapes. However, each of
36623662
these color specifications should consist of two numbers separated

jq.1.prebuilt

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jv_print.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
static char color_bufs[8][16];
3131
static const char *color_bufps[8];
3232
static const char* def_colors[] =
33-
{COL("1;30"), COL("0;37"), COL("0;37"), COL("0;37"),
33+
{COL("0;90"), COL("0;37"), COL("0;37"), COL("0;37"),
3434
COL("0;32"), COL("1;37"), COL("1;37"), COL("1;34")};
3535
#define FIELD_COLOR (colors[7])
3636

tests/shtest

+9-9
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ unset JQ_COLORS
417417

418418
## Default colors, null input
419419
$JQ -Ccn . > $d/color
420-
printf '\033[1;30mnull\033[0m\n' > $d/expect
420+
printf '\033[0;90mnull\033[0m\n' > $d/expect
421421
cmp $d/color $d/expect
422422

423423
## Set non-default color, null input
@@ -438,27 +438,27 @@ $JQ -Ccn '[{"a":true,"b":false},123,null]' > $d/color
438438
printf '[0m\033[1;37m\033[1;37'
439439
printf 'm}\033[0m\033[1;37m,\033['
440440
printf '0;37m123\033[0m\033[1;'
441-
printf '37m,\033[1;30mnull\033'
441+
printf '37m,\033[0;90mnull\033'
442442
printf '[0m\033[1;37m\033[1;37'
443443
printf 'm]\033[0m\n'
444444
} > $d/expect
445445
cmp $d/color $d/expect
446446

447447
## Set non-default colors, complex input
448-
JQ_COLORS='1;30:0;31:0;32:0;33:0;34:1;35:1;36:1;30' \
448+
JQ_COLORS='0;30:0;31:0;32:0;33:0;34:1;35:1;36:1;37' \
449449
$JQ -Ccn '[{"a":true,"b":false},123,null]' > $d/color
450450
{
451451
printf '\033[1;35m[\033[1;36m{'
452-
printf '\033[0m\033[1;30m"a"\033['
452+
printf '\033[0m\033[1;37m"a"\033['
453453
printf '0m\033[1;36m:\033[0m\033['
454454
printf '0;32mtrue\033[0m\033[1'
455-
printf ';36m,\033[0m\033[1;30m'
455+
printf ';36m,\033[0m\033[1;37m'
456456
printf '"b"\033[0m\033[1;36m:\033'
457457
printf '[0m\033[0;31mfalse\033'
458458
printf '[0m\033[1;36m\033[1;36'
459459
printf 'm}\033[0m\033[1;35m,\033['
460460
printf '0;33m123\033[0m\033[1;'
461-
printf '35m,\033[1;30mnull\033'
461+
printf '35m,\033[0;30mnull\033'
462462
printf '[0m\033[1;35m\033[1;35'
463463
printf 'm]\033[0m\n'
464464
} > $d/expect
@@ -503,16 +503,16 @@ if command -v script >/dev/null 2>&1; then
503503
fi
504504

505505
faketty $JQ -n . > $d/color
506-
printf '\033[1;30mnull\033[0m\r\n' > $d/expect
506+
printf '\033[0;90mnull\033[0m\r\n' > $d/expect
507507
cmp $d/color $d/expect
508508
NO_COLOR= faketty $JQ -n . > $d/color
509-
printf '\033[1;30mnull\033[0m\r\n' > $d/expect
509+
printf '\033[0;90mnull\033[0m\r\n' > $d/expect
510510
cmp $d/color $d/expect
511511
NO_COLOR=1 faketty $JQ -n . > $d/color
512512
printf 'null\r\n' > $d/expect
513513
cmp $d/color $d/expect
514514
NO_COLOR=1 faketty $JQ -Cn . > $d/color
515-
printf '\033[1;30mnull\033[0m\r\n' > $d/expect
515+
printf '\033[0;90mnull\033[0m\r\n' > $d/expect
516516
cmp $d/color $d/expect
517517
fi
518518

0 commit comments

Comments
 (0)