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

Function setMsgTextColor

win/win32/mhmsgwnd.c:575–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573#endif // MSG_WRAP_TEXT
574
575COLORREF
576setMsgTextColor(HDC hdc, int gray)
577{
578 COLORREF fg, color1, color2;
579 if (gray) {
580 if (message_bg_brush) {
581 color1 = message_bg_color;
582 color2 = message_fg_color;
583 } else {
584 color1 = (COLORREF) GetSysColor(DEFAULT_COLOR_BG_MSG);
585 color2 = (COLORREF) GetSysColor(DEFAULT_COLOR_FG_MSG);
586 }
587 /* Make a "gray" color by taking the average of the individual R,G,B
588 components of two colors. Thanks to Jonathan del Strother */
589 fg = RGB((GetRValue(color1) + GetRValue(color2)) / 2,
590 (GetGValue(color1) + GetGValue(color2)) / 2,
591 (GetBValue(color1) + GetBValue(color2)) / 2);
592 } else {
593 fg = message_fg_brush ? message_fg_color
594 : (COLORREF) GetSysColor(DEFAULT_COLOR_FG_MSG);
595 }
596
597 return SetTextColor(hdc, fg);
598}
599
600void
601onPaint(HWND hWnd)

Callers 1

onPaintFunction · 0.70

Calls 1

RGBClass · 0.50

Tested by

no test coverage detected