diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2021-12-16 13:59:04 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2021-12-18 00:34:28 +0800 |
commit | 1fb59d13c2e32b9543195601149071ff4b2887d4 (patch) | |
tree | 981177e1076684cde68ce69f0006b3158dcd82f7 /core/math | |
parent | 58712e96aea12bda2d5111d96961f529d15a693c (diff) |
Fix font preview text color on light background
Diffstat (limited to 'core/math')
-rw-r--r-- | core/math/color.h | 4 |
1 files changed, 4 insertions, 0 deletions
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; |