MCPcopy Create free account
hub / github.com/NetHack/NetHack / parse_hexstr

Function parse_hexstr

win/curses/curswins.c:294–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

292}
293
294boolean
295parse_hexstr(char *colorbuf, int *red, int *green, int *blue)
296{
297 int len = colorbuf ? strlen(colorbuf) : 0;
298
299 if (len == 7 && colorbuf[0] == '#') {
300 char tmpbuf[16];
301
302 Sprintf(tmpbuf, "0x%c%c", colorbuf[1], colorbuf[2]);
303 *red = strtol(tmpbuf, NULL, 0);
304 Sprintf(tmpbuf, "0x%c%c", colorbuf[3], colorbuf[4]);
305 *green = strtol(tmpbuf, NULL, 0);
306 Sprintf(tmpbuf, "0x%c%c", colorbuf[5], colorbuf[6]);
307 *blue = strtol(tmpbuf, NULL, 0);
308 return TRUE;
309 }
310 return FALSE;
311}
312
313void
314curses_parse_wid_colors(int wid, char *fg, char *bg)

Callers 1

curses_parse_wid_colorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected