{"thread":{"id":"61390","subject":"[PATCH 0/3] color: add support for 12-bit RGB colors","startedAt":"2024-04-29T16:52:35Z","lastAt":"2024-05-03T17:47:54Z","messageCount":13,"participants":["Beat Bolli","Junio C Hamano","Taylor Blau","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"493652","messageId":"20240429164849.78509-1-dev+git@drbeat.li","threadId":"61390","inReplyTo":null,"subject":"[PATCH 0/3] color: add support for 12-bit RGB colors","fromName":"Beat Bolli","fromEmail":"bb@drbeat.li","sentAt":"2024-04-29T16:48:46Z","receivedAt":"2024-04-29T16:52:35Z","isPatch":true,"sender":{"key":"bb@drbeat.li","avatar":null},"body":" * The color parsing code learned to handle 12-bit RGB colors.\n\nThe first commit fixes a typo, the second one adds some test coverage\nfor invalid RGB colors, and the final one extends the RGB color parser\nto recognize 12-bit colors, as in #f0f.\n\nBeat Bolli (3):\n  t/t4026-color: remove an extra double quote character\n  t/t4026-color: add test coverage for invalid RGB colors\n  color: add support for 12-bit RGB colors\n\n Documentation/config.txt |  3 ++-\n color.c                  | 21 ++++++++++++++-------\n color.h                  |  3 ++-\n t/t4026-color.sh         | 18 +++++++++++++++---\n 4 files changed, 33 insertions(+), 12 deletions(-)\n\n-- \n2.44.0\n\n"},{"id":"493653","messageId":"20240429164849.78509-2-dev+git@drbeat.li","threadId":"61390","inReplyTo":"20240429164849.78509-1-dev+git@drbeat.li","subject":"[PATCH 1/3] t/t4026-color: remove an extra double quote character","fromName":"Beat Bolli","fromEmail":"bb@drbeat.li","sentAt":"2024-04-29T16:48:47Z","receivedAt":"2024-04-29T16:52:36Z","isPatch":true,"sender":{"key":"bb@drbeat.li","avatar":null},"body":"This is most probably just an editing left-over from cb357221a4 (t4026:\ntest \"normal\" color, 2014-11-20) which added this test.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n t/t4026-color.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex cc3f60d468f4..37622451fc23 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -112,7 +112,7 @@ test_expect_success '\"default\" can be combined with attributes' '\n \tcolor \"default default no-reverse bold\" \"[1;27;39;49m\"\n '\n \n-test_expect_success '\"normal\" yields no color at all\"' '\n+test_expect_success '\"normal\" yields no color at all' '\n \tcolor \"normal black\" \"[40m\"\n '\n \n-- \n2.44.0\n\n"},{"id":"493654","messageId":"20240429164849.78509-3-dev+git@drbeat.li","threadId":"61390","inReplyTo":"20240429164849.78509-1-dev+git@drbeat.li","subject":"[PATCH 2/3] t/t4026-color: add test coverage for invalid RGB colors","fromName":"Beat Bolli","fromEmail":"bb@drbeat.li","sentAt":"2024-04-29T16:48:48Z","receivedAt":"2024-04-29T16:52:38Z","isPatch":true,"sender":{"key":"bb@drbeat.li","avatar":null},"body":"Make sure that the RGB color parser rejects invalid characters.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n t/t4026-color.sh | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 37622451fc23..0c39bd74a613 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -140,6 +140,15 @@ test_expect_success 'extra character after attribute' '\n \tinvalid_color \"dimX\"\n '\n \n+test_expect_success 'non-hex character in RGB color' '\n+\tinvalid_color \"#x23456\" &&\n+\tinvalid_color \"#1x3456\" &&\n+\tinvalid_color \"#12x456\" &&\n+\tinvalid_color \"#123x56\" &&\n+\tinvalid_color \"#1234x6\" &&\n+\tinvalid_color \"#12345x\"\n+'\n+\n test_expect_success 'unknown color slots are ignored (diff)' '\n \tgit config color.diff.nosuchslotwilleverbedefined white &&\n \tgit diff --color\n-- \n2.44.0\n\n"},{"id":"493655","messageId":"20240429164849.78509-4-dev+git@drbeat.li","threadId":"61390","inReplyTo":"20240429164849.78509-1-dev+git@drbeat.li","subject":"[PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Beat Bolli","fromEmail":"bb@drbeat.li","sentAt":"2024-04-29T16:48:49Z","receivedAt":"2024-04-29T16:52:38Z","isPatch":true,"sender":{"key":"bb@drbeat.li","avatar":null},"body":"RGB color parsing currently supports 24-bit values in the form #RRGGBB.\n\nAs in Cascading Style Sheets (CSS [1]), also allow to specify an RGB color\nusing only three digits with #RGB.\n\nIn this shortened form, each of the digits is – again, as in CSS –\nduplicated to convert the color to 24 bits, e.g. #f1b specifies the same\ncolor as #ff11bb.\n\nIn color.h, remove the '0x' prefix in the example to match the actual\nsyntax.\n\n[1] https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n Documentation/config.txt |  3 ++-\n color.c                  | 21 ++++++++++++++-------\n color.h                  |  3 ++-\n t/t4026-color.sh         |  9 ++++++---\n 4 files changed, 24 insertions(+), 12 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 70b448b13262..6f649c997c0f 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -316,7 +316,8 @@ terminals, this is usually not the same as setting to \"white black\".\n Colors may also be given as numbers between 0 and 255; these use ANSI\n 256-color mode (but note that not all terminals may support this).  If\n your terminal supports it, you may also specify 24-bit RGB values as\n-hex, like `#ff0ab3`.\n+hex, like `#ff0ab3`, or 12-bit RGB values like `#f1b`, which is\n+equivalent to the 24-bit color `#ff11bb`.\n +\n The accepted attributes are `bold`, `dim`, `ul`, `blink`, `reverse`,\n `italic`, and `strike` (for crossed-out or \"strikethrough\" letters).\ndiff --git a/color.c b/color.c\nindex f663c06ac4ed..227a5ab2f42e 100644\n--- a/color.c\n+++ b/color.c\n@@ -64,12 +64,16 @@ static int match_word(const char *word, int len, const char *match)\n \treturn !strncasecmp(word, match, len) && !match[len];\n }\n \n-static int get_hex_color(const char *in, unsigned char *out)\n+static int get_hex_color(const char **inp, int width, unsigned char *out)\n {\n+\tconst char *in = *inp;\n \tunsigned int val;\n-\tval = (hexval(in[0]) << 4) | hexval(in[1]);\n+\n+\tassert(width == 1 || width == 2);\n+\tval = (hexval(in[0]) << 4) | hexval(in[width - 1]);\n \tif (val & ~0xff)\n \t\treturn -1;\n+\t*inp += width;\n \t*out = val;\n \treturn 0;\n }\n@@ -135,11 +139,14 @@ static int parse_color(struct color *out, const char *name, int len)\n \t\treturn 0;\n \t}\n \n-\t/* Try a 24-bit RGB value */\n-\tif (len == 7 && name[0] == '#') {\n-\t\tif (!get_hex_color(name + 1, &out->red) &&\n-\t\t    !get_hex_color(name + 3, &out->green) &&\n-\t\t    !get_hex_color(name + 5, &out->blue)) {\n+\t/* Try a 24- or 12-bit RGB value prefixed with '#' */\n+\tif ((len == 7 || len == 4) && name[0] == '#') {\n+\t\tint width_per_color = (len == 7) ? 2 : 1;\n+\t\tconst char *color = name + 1;\n+\n+\t\tif (!get_hex_color(&color, width_per_color, &out->red) &&\n+\t\t    !get_hex_color(&color, width_per_color, &out->green) &&\n+\t\t    !get_hex_color(&color, width_per_color, &out->blue)) {\n \t\t\tout->type = COLOR_RGB;\n \t\t\treturn 0;\n \t\t}\ndiff --git a/color.h b/color.h\nindex bb28343be210..7ed259a35bb4 100644\n--- a/color.h\n+++ b/color.h\n@@ -112,7 +112,8 @@ int want_color_fd(int fd, int var);\n  * Translate a Git color from 'value' into a string that the terminal can\n  * interpret and store it into 'dst'. The Git color values are of the form\n  * \"foreground [background] [attr]\" where fore- and background can be a color\n- * name (\"red\"), a RGB code (#0xFF0000) or a 256-color-mode from the terminal.\n+ * name (\"red\"), a RGB code (#FF0000 or #F00) or a 256-color-mode from the\n+ * terminal.\n  */\n int color_parse(const char *value, char *dst);\n int color_parse_mem(const char *value, int len, char *dst);\ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 0c39bd74a613..9a6f8a4bc5bf 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -96,8 +96,8 @@ test_expect_success '256 colors' '\n \tcolor \"254 bold 255\" \"[1;38;5;254;48;5;255m\"\n '\n \n-test_expect_success '24-bit colors' '\n-\tcolor \"#ff00ff black\" \"[38;2;255;0;255;40m\"\n+test_expect_success 'RGB colors' '\n+\tcolor \"#ff00ff #0f0\" \"[38;2;255;0;255;48;2;0;255;0m\"\n '\n \n test_expect_success '\"default\" foreground' '\n@@ -146,7 +146,10 @@ test_expect_success 'non-hex character in RGB color' '\n \tinvalid_color \"#12x456\" &&\n \tinvalid_color \"#123x56\" &&\n \tinvalid_color \"#1234x6\" &&\n-\tinvalid_color \"#12345x\"\n+\tinvalid_color \"#12345x\" &&\n+\tinvalid_color \"#x23\" &&\n+\tinvalid_color \"#1x3\" &&\n+\tinvalid_color \"#12x\"\n '\n \n test_expect_success 'unknown color slots are ignored (diff)' '\n-- \n2.44.0\n\n"},{"id":"493663","messageId":"xmqqo79sulqh.fsf@gitster.g","threadId":"61390","inReplyTo":"20240429164849.78509-4-dev+git@drbeat.li","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-29T17:23:02Z","receivedAt":"2024-04-29T17:23:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Beat Bolli\" <bb@drbeat.li> writes:\n\n> +static int get_hex_color(const char **inp, int width, unsigned char *out)\n>  {\n> +\tconst char *in = *inp;\n>  \tunsigned int val;\n> -\tval = (hexval(in[0]) << 4) | hexval(in[1]);\n> +\n> +\tassert(width == 1 || width == 2);\n> +\tval = (hexval(in[0]) << 4) | hexval(in[width - 1]);\n\nSo this makes #111111 out of #111 and #ffffff out of #fff.  Nice.\n\n> diff --git a/color.h b/color.h\n> index bb28343be210..7ed259a35bb4 100644\n> --- a/color.h\n> +++ b/color.h\n> @@ -112,7 +112,8 @@ int want_color_fd(int fd, int var);\n>   * Translate a Git color from 'value' into a string that the terminal can\n>   * interpret and store it into 'dst'. The Git color values are of the form\n>   * \"foreground [background] [attr]\" where fore- and background can be a color\n> - * name (\"red\"), a RGB code (#0xFF0000) or a 256-color-mode from the terminal.\n> + * name (\"red\"), a RGB code (#FF0000 or #F00) or a 256-color-mode from the\n> + * terminal.\n>   */\n\nGood.  Hopefully we do not have such extra 0x in our end-user facing\ndocumentation?\n\n> diff --git a/t/t4026-color.sh b/t/t4026-color.sh\n> index 0c39bd74a613..9a6f8a4bc5bf 100755\n> --- a/t/t4026-color.sh\n> +++ b/t/t4026-color.sh\n> @@ -96,8 +96,8 @@ test_expect_success '256 colors' '\n>  \tcolor \"254 bold 255\" \"[1;38;5;254;48;5;255m\"\n>  '\n>  \n> -test_expect_success '24-bit colors' '\n> -\tcolor \"#ff00ff black\" \"[38;2;255;0;255;40m\"\n> +test_expect_success 'RGB colors' '\n> +\tcolor \"#ff00ff #0f0\" \"[38;2;255;0;255;48;2;0;255;0m\"\n>  '\n>  \n>  test_expect_success '\"default\" foreground' '\n> @@ -146,7 +146,10 @@ test_expect_success 'non-hex character in RGB color' '\n>  \tinvalid_color \"#12x456\" &&\n>  \tinvalid_color \"#123x56\" &&\n>  \tinvalid_color \"#1234x6\" &&\n> -\tinvalid_color \"#12345x\"\n> +\tinvalid_color \"#12345x\" &&\n> +\tinvalid_color \"#x23\" &&\n> +\tinvalid_color \"#1x3\" &&\n> +\tinvalid_color \"#12x\"\n>  '\n\nOK, looking good.\n\nThanks.\n"},{"id":"493664","messageId":"d2d5bbfc-d2bb-4112-a12d-f19950125cb5@drbeat.li","threadId":"61390","inReplyTo":"xmqqo79sulqh.fsf@gitster.g","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2024-04-29T17:42:09Z","receivedAt":"2024-04-29T17:42:13Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 29.04.2024 19:23, Junio C Hamano wrote:\n> \"Beat Bolli\" <bb@drbeat.li> writes:\n> \n>> diff --git a/color.h b/color.h\n>> index bb28343be210..7ed259a35bb4 100644\n>> --- a/color.h\n>> +++ b/color.h\n>> @@ -112,7 +112,8 @@ int want_color_fd(int fd, int var);\n>>    * Translate a Git color from 'value' into a string that the terminal can\n>>    * interpret and store it into 'dst'. The Git color values are of the form\n>>    * \"foreground [background] [attr]\" where fore- and background can be a color\n>> - * name (\"red\"), a RGB code (#0xFF0000) or a 256-color-mode from the terminal.\n>> + * name (\"red\"), a RGB code (#FF0000 or #F00) or a 256-color-mode from the\n>> + * terminal.\n>>    */\n> \n> Good.  Hopefully we do not have such extra 0x in our end-user facing\n> documentation?\n\nNo, this was the only '#0x' I found. config.txt is fine as per the first \nhunk.\n\n\n"},{"id":"493710","messageId":"ZjATDKqgzYFJVDjj@nand.local","threadId":"61390","inReplyTo":"20240429164849.78509-1-dev+git@drbeat.li","subject":"Re: [PATCH 0/3] color: add support for 12-bit RGB colors","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2024-04-29T21:37:16Z","receivedAt":"2024-04-29T21:37:21Z","isPatch":true,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Mon, Apr 29, 2024 at 06:48:46PM +0200, Beat Bolli wrote:\n>  Documentation/config.txt |  3 ++-\n>  color.c                  | 21 ++++++++++++++-------\n>  color.h                  |  3 ++-\n>  t/t4026-color.sh         | 18 +++++++++++++++---\n>  4 files changed, 33 insertions(+), 12 deletions(-)\n\nLooks very nice. The first two patches are trivially correct, and I took\na close look at 3/3 and couldn't find any errors.\n\n    Reviewed-by: Taylor Blau <me@ttaylorr.com>\n\nThanks,\nTaylor\n"},{"id":"493753","messageId":"20240430105727.GI1279403@coredump.intra.peff.net","threadId":"61390","inReplyTo":"20240429164849.78509-4-dev+git@drbeat.li","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-04-30T10:57:27Z","receivedAt":"2024-04-30T10:57:28Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 29, 2024 at 06:48:49PM +0200, Beat Bolli wrote:\n\n> -test_expect_success '24-bit colors' '\n> -\tcolor \"#ff00ff black\" \"[38;2;255;0;255;40m\"\n> +test_expect_success 'RGB colors' '\n> +\tcolor \"#ff00ff #0f0\" \"[38;2;255;0;255;48;2;0;255;0m\"\n>  '\n\nHeh, I would still think of it as a shorthand for 24-bit color, but I\nguess you could argue it is now 12-bit color. :)\n\n(Only observing, I think the new name is fine).\n\n>  test_expect_success '\"default\" foreground' '\n> @@ -146,7 +146,10 @@ test_expect_success 'non-hex character in RGB color' '\n>  \tinvalid_color \"#12x456\" &&\n>  \tinvalid_color \"#123x56\" &&\n>  \tinvalid_color \"#1234x6\" &&\n> -\tinvalid_color \"#12345x\"\n> +\tinvalid_color \"#12345x\" &&\n> +\tinvalid_color \"#x23\" &&\n> +\tinvalid_color \"#1x3\" &&\n> +\tinvalid_color \"#12x\"\n>  '\n\nThis made me wonder what we'd do with \"#1\", \"#12\", \"#1234\", etc. Looking\nat the code change, I think we'd continue to reject them. I wonder if it\nis worth covering here.\n\n-Peff\n"},{"id":"493754","messageId":"20240430105927.GJ1279403@coredump.intra.peff.net","threadId":"61390","inReplyTo":"20240429164849.78509-2-dev+git@drbeat.li","subject":"Re: [PATCH 1/3] t/t4026-color: remove an extra double quote character","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-04-30T10:59:27Z","receivedAt":"2024-04-30T10:59:29Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Apr 29, 2024 at 06:48:47PM +0200, Beat Bolli wrote:\n\n> This is most probably just an editing left-over from cb357221a4 (t4026:\n> test \"normal\" color, 2014-11-20) which added this test.\n\nYeah, I suspect that is correct. Modulo a minor comment I left on the\nthird patch, the whole series looks good to me.\n\n-Peff\n"},{"id":"493803","messageId":"xmqqmspazrj3.fsf@gitster.g","threadId":"61390","inReplyTo":"20240430105727.GI1279403@coredump.intra.peff.net","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-30T17:31:12Z","receivedAt":"2024-04-30T17:31:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> On Mon, Apr 29, 2024 at 06:48:49PM +0200, Beat Bolli wrote:\n>\n>> -test_expect_success '24-bit colors' '\n>> -\tcolor \"#ff00ff black\" \"[38;2;255;0;255;40m\"\n>> +test_expect_success 'RGB colors' '\n>> +\tcolor \"#ff00ff #0f0\" \"[38;2;255;0;255;48;2;0;255;0m\"\n>>  '\n>\n> Heh, I would still think of it as a shorthand for 24-bit color, but I\n> guess you could argue it is now 12-bit color. :)\n>\n> (Only observing, I think the new name is fine).\n>\n>>  test_expect_success '\"default\" foreground' '\n>> @@ -146,7 +146,10 @@ test_expect_success 'non-hex character in RGB color' '\n>>  \tinvalid_color \"#12x456\" &&\n>>  \tinvalid_color \"#123x56\" &&\n>>  \tinvalid_color \"#1234x6\" &&\n>> -\tinvalid_color \"#12345x\"\n>> +\tinvalid_color \"#12345x\" &&\n>> +\tinvalid_color \"#x23\" &&\n>> +\tinvalid_color \"#1x3\" &&\n>> +\tinvalid_color \"#12x\"\n>>  '\n>\n> This made me wonder what we'd do with \"#1\", \"#12\", \"#1234\", etc. Looking\n> at the code change, I think we'd continue to reject them. I wonder if it\n> is worth covering here.\n\nWorth covering in this test, yes, but I am perfectly OK with leaving\nit outside the series as a #leftoverbit clean-up.\n"},{"id":"493804","messageId":"xmqqikzyzoam.fsf@gitster.g","threadId":"61390","inReplyTo":"xmqqmspazrj3.fsf@gitster.g","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-30T18:41:05Z","receivedAt":"2024-04-30T18:41:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>>> @@ -146,7 +146,10 @@ test_expect_success 'non-hex character in RGB color' '\n>>>  \tinvalid_color \"#12x456\" &&\n>>>  \tinvalid_color \"#123x56\" &&\n>>>  \tinvalid_color \"#1234x6\" &&\n>>> -\tinvalid_color \"#12345x\"\n>>> +\tinvalid_color \"#12345x\" &&\n>>> +\tinvalid_color \"#x23\" &&\n>>> +\tinvalid_color \"#1x3\" &&\n>>> +\tinvalid_color \"#12x\"\n>>>  '\n>>\n>> This made me wonder what we'd do with \"#1\", \"#12\", \"#1234\", etc. Looking\n>> at the code change, I think we'd continue to reject them. I wonder if it\n>> is worth covering here.\n>\n> Worth covering in this test, yes, but I am perfectly OK with leaving\n> it outside the series as a #leftoverbit clean-up.\n\nAh, I take it back.  The preimage was added by [2/3] so it is fair\nto say that that step would be the right place to do that from the\nget-go.\n\n"},{"id":"493806","messageId":"xmqqa5laznbx.fsf@gitster.g","threadId":"61390","inReplyTo":"xmqqikzyzoam.fsf@gitster.g","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-04-30T19:01:54Z","receivedAt":"2024-04-30T19:01:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Ah, I take it back.  The preimage was added by [2/3] so it is fair\n> to say that that step would be the right place to do that from the\n> get-go.\n\nPerhaps something like this can be squashed in.\n\nSubject: [PATCH] fixup! t/t4026-color: add test coverage for invalid RGB colors\n\n---\n t/t4026-color.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t4026-color.sh b/t/t4026-color.sh\nindex 9a6f8a4bc5..e60aa588c2 100755\n--- a/t/t4026-color.sh\n+++ b/t/t4026-color.sh\n@@ -140,6 +140,14 @@ test_expect_success 'extra character after attribute' '\n \tinvalid_color \"dimX\"\n '\n \n+test_expect_success 'wrong number of letters in RGB color' '\n+\tinvalid_color \"#1\" &&\n+\tinvalid_color \"#23\" &&\n+\tinvalid_color \"#4567\" &&\n+\tinvalid_color \"#89abc\" &&\n+\tinvalid_color \"#def0123\"\n+'\n+\n test_expect_success 'non-hex character in RGB color' '\n \tinvalid_color \"#x23456\" &&\n \tinvalid_color \"#1x3456\" &&\n-- \n2.45.0\n\n"},{"id":"494031","messageId":"20240503174753.GE3631237@coredump.intra.peff.net","threadId":"61390","inReplyTo":"xmqqa5laznbx.fsf@gitster.g","subject":"Re: [PATCH 3/3] color: add support for 12-bit RGB colors","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-05-03T17:47:53Z","receivedAt":"2024-05-03T17:47:54Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Apr 30, 2024 at 12:01:54PM -0700, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Ah, I take it back.  The preimage was added by [2/3] so it is fair\n> > to say that that step would be the right place to do that from the\n> > get-go.\n> \n> Perhaps something like this can be squashed in.\n> \n> Subject: [PATCH] fixup! t/t4026-color: add test coverage for invalid RGB colors\n\nYup, that looks good to me.\n\n-Peff\n"}]}