diff --git a/src/k_color.c b/src/k_color.c index d875b8b68..0f21dc394 100644 --- a/src/k_color.c +++ b/src/k_color.c @@ -43,11 +43,12 @@ UINT16 altinvinccolors[16] = { --------------------------------------------------*/ UINT8 K_ColorRelativeLuminance(UINT8 r, UINT8 g, UINT8 b) { - UINT32 redweight = 1063 * r; - UINT32 greenweight = 3576 * g; - UINT32 blueweight = 361 * b; - UINT32 brightness = (redweight + greenweight + blueweight) / 5000; - return min(brightness, UINT8_MAX); + // These are the BT.601 coefficents + // See also: https://en.wikipedia.org/wiki/Rec._601 + UINT32 redweight = 299 * r; + UINT32 greenweight = 587 * g; + UINT32 blueweight = 114 * b; + return min((redweight + greenweight + blueweight) / 1000, UINT8_MAX); } /*--------------------------------------------------