MCPcopy Create free account
hub / github.com/git/git / get_hex_color

Function get_hex_color

color.c:69–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69static int get_hex_color(const char **inp, int width, unsigned char *out)
70{
71 const char *in = *inp;
72 unsigned int val;
73
74 assert(width == 1 || width == 2);
75 val = (hexval(in[0]) << 4) | hexval(in[width - 1]);
76 if (val & ~0xff)
77 return -1;
78 *inp += width;
79 *out = val;
80 return 0;
81}
82
83/*
84 * If an ANSI color is recognized in "name", fill "out" and return 0.

Callers 1

parse_colorFunction · 0.85

Calls 1

hexvalFunction · 0.85

Tested by

no test coverage detected