OpenClonk
C4ConsoleQtPropListViewer.cpp File Reference
Include dependency graph for C4ConsoleQtPropListViewer.cpp:

Go to the source code of this file.

Functions

uint32_t GetTextColorForBackground (uint32_t background_color)
 

Function Documentation

◆ GetTextColorForBackground()

uint32_t GetTextColorForBackground ( uint32_t  background_color)

Definition at line 751 of file C4ConsoleQtPropListViewer.cpp.

752 {
753  // White text on dark background; black text on bright background
754  uint8_t r = (background_color >> 16) & 0xff;
755  uint8_t g = (background_color >> 8) & 0xff;
756  uint8_t b = (background_color >> 0) & 0xff;
757  int32_t lgt = r * 30 + g * 59 + b * 11;
758  return (lgt > 16000) ? 0 : 0xffffff;
759 }
#define b

References b.