summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-04 09:46:10 +0100
committerGitHub <noreply@github.com>2022-03-04 09:46:10 +0100
commit39dc25376e2bfaf14648dd4873a7c702be2e0323 (patch)
tree04a5a816b248524f85d7454b3bad95e13ed38262 /editor
parentdd98e75e762a235079d184d59a7ad0322d905717 (diff)
parent6b003384d763241905d0ed12c90ba29b497ad722 (diff)
Merge pull request #58731 from Calinou/editor-theme-clamp-base-colors
Clamp the editor theme's base colors to avoid various issues
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_themes.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 05aa638a4b..cdf51dda20 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -411,9 +411,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Colors
bool dark_theme = EditorSettings::get_singleton()->is_dark_theme();
- const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast);
- const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5);
- const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2);
+ // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues.
+ // Some places in the editor use 8-bit integer colors.
+ const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast).clamp();
+ const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5).clamp();
+ const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2).clamp();
const Color background_color = dark_color_2;