From 1fb59d13c2e32b9543195601149071ff4b2887d4 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Thu, 16 Dec 2021 13:59:04 +0800 Subject: Fix font preview text color on light background --- core/math/color.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/math') diff --git a/core/math/color.h b/core/math/color.h index ffd0fd8f6e..815dd98d96 100644 --- a/core/math/color.h +++ b/core/math/color.h @@ -94,6 +94,10 @@ struct Color { void invert(); Color inverted() const; + _FORCE_INLINE_ float get_luminance() const { + return 0.2126 * r + 0.7152 * g + 0.0722 * b; + } + _FORCE_INLINE_ Color lerp(const Color &p_to, float p_weight) const { Color res = *this; -- cgit v1.2.3