aboutsummaryrefslogtreecommitdiffstats
path: root/color.h
diff options
context:
space:
mode:
authorBeat Bolli <bb@drbeat.li>2024-05-02 13:03:31 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-02 09:30:38 -0700
commit7b97dfe47ba3a61f09cc26154540d74afdd3283d (patch)
tree708e62c41acb95cfc085b5e5bab90f34f81fd36c /color.h
parentd78d692efcc734195515fd060a1f35cb5123a72d (diff)
downloadgit-7b97dfe47ba3a61f09cc26154540d74afdd3283d.tar.gz
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>
Diffstat (limited to 'color.h')
-rw-r--r--color.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/color.h b/color.h
index bb28343be2..7ed259a35b 100644
--- a/color.h
+++ b/color.h
@@ -112,7 +112,8 @@ int want_color_fd(int fd, int var);
* Translate a Git color from 'value' into a string that the terminal can
* interpret and store it into 'dst'. The Git color values are of the form
* "foreground [background] [attr]" where fore- and background can be a color
- * name ("red"), a RGB code (#0xFF0000) or a 256-color-mode from the terminal.
+ * name ("red"), a RGB code (#FF0000 or #F00) or a 256-color-mode from the
+ * terminal.
*/
int color_parse(const char *value, char *dst);
int color_parse_mem(const char *value, int len, char *dst);