color: add support for 12-bit RGB colors
commit7b97dfe47ba3a61f09cc26154540d74afdd3283d
authorBeat Bolli <bb@drbeat.li>
Thu, 2 May 2024 11:03:31 +0000 (2 13:03 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 May 2024 16:30:38 +0000 (2 09:30 -0700)
tree708e62c41acb95cfc085b5e5bab90f34f81fd36c
parentd78d692efcc734195515fd060a1f35cb5123a72d
color: add support for 12-bit RGB colors

RGB color parsing currently supports 24-bit values in the form #RRGGBB.

As in Cascading Style Sheets (CSS [1]), also allow to specify an RGB color
using only three digits with #RGB.

In this shortened form, each of the digits is – again, as in CSS –
duplicated to convert the color to 24 bits, e.g. #f1b specifies the same
color as #ff11bb.

In color.h, remove the '0x' prefix in the example to match the actual
syntax.

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/config.txt
color.c
color.h
t/t4026-color.sh