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

Function init_custom_colors

sys/windows/consoletty.c:370–445  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368#define rgbtable_offset 16
369
370static void
371init_custom_colors(void)
372{
373 char bkcolorbuf[32];
374
375 customcolors[CLR_BLACK] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 131]);
376 customcolors[CLR_RED] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 5]);
377 customcolors[CLR_GREEN] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 31]);
378 customcolors[CLR_BROWN] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 104]);
379 customcolors[CLR_BLUE] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 58]);
380 customcolors[CLR_MAGENTA] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 76]);
381 customcolors[CLR_CYAN] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 48]);
382 customcolors[CLR_GRAY] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 73]);
383 customcolors[NO_COLOR] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 137]);
384 customcolors[CLR_ORANGE] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 15]);
385 customcolors[CLR_BRIGHT_GREEN] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 34]);
386 customcolors[CLR_YELLOW] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 18]);
387 customcolors[CLR_BRIGHT_BLUE] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 69]);
388 customcolors[CLR_BRIGHT_MAGENTA] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 84]);
389 customcolors[CLR_BRIGHT_CYAN] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 49]);
390 customcolors[CLR_WHITE] = colortable_to_bgr_int32(&colortable[rgbtable_offset + 138]);
391
392/* esc_seq_colors[CLR_BLACK] = "\x1b[30m"; */
393 esc_seq_colors[CLR_BLACK] = "\x1b[38;2;47;79;79m";
394 esc_seq_colors[CLR_RED] = "\x1b[31m";
395 esc_seq_colors[CLR_GREEN] = "\x1b[32m";
396 esc_seq_colors[CLR_YELLOW] = "\x1b[38;2;255;255;0m";
397 esc_seq_colors[CLR_BLUE] = "\x1b[38;2;100;149;237m";
398 esc_seq_colors[CLR_MAGENTA] = "\x1b[35m";
399 esc_seq_colors[CLR_CYAN] = "\x1b[36m";
400 esc_seq_colors[CLR_WHITE] = "\x1b[37m";
401
402 esc_seq_colors[CLR_BROWN] = "\x1b[38;2;205;133;63m";
403// esc_seq_colors[CLR_GRAY] = "\x1b[31m\x1b[32m\x1b[34m";
404 esc_seq_colors[CLR_GRAY] = "\x1b[90m";
405 esc_seq_colors[NO_COLOR] = "\x1b[39m";
406 esc_seq_colors[CLR_ORANGE] = "\x1b[38;2;255;140;0m";
407 esc_seq_colors[CLR_BRIGHT_GREEN] = "\x1b[39m";
408 esc_seq_colors[CLR_BRIGHT_BLUE] = "\x1b[34m\x1b[94m";
409 esc_seq_colors[CLR_BRIGHT_MAGENTA] = "\x1b[35m\x1b[95m";
410 esc_seq_colors[CLR_BRIGHT_CYAN] = "\x1b[36m\x1b[96m";
411
412 /* Sprintf(tmp, "\033[%dm", ((color % 8) + 40)); */
413 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_BLACK % 8) + 40));
414 esc_seq_bkcolors[CLR_BLACK] = dupstr(bkcolorbuf);
415 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_RED % 8) + 40));
416 esc_seq_bkcolors[CLR_RED] = dupstr(bkcolorbuf);
417 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_GREEN % 8) + 40));
418 esc_seq_bkcolors[CLR_GREEN] = dupstr(bkcolorbuf);
419 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_YELLOW % 8) + 40));
420 esc_seq_bkcolors[CLR_YELLOW] = dupstr(bkcolorbuf);
421 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_BLUE % 8) + 40));
422 esc_seq_bkcolors[CLR_BLUE] = dupstr(bkcolorbuf);
423 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_MAGENTA % 8) + 40));
424 esc_seq_bkcolors[CLR_MAGENTA] = dupstr(bkcolorbuf);
425 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_CYAN % 8) + 40));
426 esc_seq_bkcolors[CLR_CYAN] = dupstr(bkcolorbuf);
427 Snprintf(bkcolorbuf, sizeof bkcolorbuf, "\x1b[%dm", ((CLR_WHITE % 8) + 40));

Callers 1

consoletty.cFile · 0.85

Calls 2

colortable_to_bgr_int32Function · 0.85
dupstrFunction · 0.85

Tested by

no test coverage detected