Skip to content

Commit

Permalink
Fix warning icon visibility on light themes
Browse files Browse the repository at this point in the history
  • Loading branch information
rsubtil committed May 5, 2024
1 parent 7ebc866 commit db61cf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 0 additions & 2 deletions editor/themes/editor_color_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,7 @@ void EditorColorMap::create() {
add_conversion_exception("ZoomReset");
add_conversion_exception("LockViewport");
add_conversion_exception("GroupViewport");
add_conversion_exception("StatusError");
add_conversion_exception("StatusSuccess");
add_conversion_exception("StatusWarning");
add_conversion_exception("OverbrightIndicator");
add_conversion_exception("MaterialPreviewCube");
add_conversion_exception("MaterialPreviewSphere");
Expand Down
14 changes: 10 additions & 4 deletions editor/themes/editor_theme_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ void EditorThemeManager::_create_shared_styles(const Ref<EditorTheme> &p_theme,
if (!p_config.dark_theme) {
// Darken some colors to be readable on a light background.
p_config.success_color = p_config.success_color.lerp(p_config.mono_color, 0.35);
p_config.warning_color = p_config.warning_color.lerp(p_config.mono_color, 0.35);
p_config.error_color = p_config.error_color.lerp(p_config.mono_color, 0.25);
p_config.warning_color = Color(0.82, 0.56, 0.1);
p_config.error_color = Color(0.8, 0.22, 0.22);
}

p_theme->set_color("mono_color", EditorStringName(Editor), p_config.mono_color);
Expand Down Expand Up @@ -1901,14 +1901,20 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
// When pressed, don't tint the icons with the accent color, just leave them normal.
p_theme->set_color("icon_pressed_color", "EditorLogFilterButton", p_config.icon_normal_color);
// When unpressed, dim the icons.
p_theme->set_color("icon_normal_color", "EditorLogFilterButton", p_config.icon_disabled_color);
Color icon_normal_color = Color(p_config.icon_normal_color, (p_config.dark_theme ? 0.4 : 0.8));
p_theme->set_color("icon_normal_color", "EditorLogFilterButton", icon_normal_color);
Color icon_hover_color = p_config.icon_normal_color * (p_config.dark_theme ? 1.15 : 1.0);
icon_hover_color.a = 1.0;
p_theme->set_color("icon_hover_color", "EditorLogFilterButton", icon_hover_color);

// When pressed, add a small bottom border to the buttons to better show their active state,
// similar to active tabs.
Ref<StyleBoxFlat> editor_log_button_pressed = style_flat_button_pressed->duplicate();
editor_log_button_pressed->set_border_width(SIDE_BOTTOM, 2 * EDSCALE);
editor_log_button_pressed->set_border_color(p_config.accent_color);

if (!p_config.dark_theme) {
editor_log_button_pressed->set_bg_color(flat_pressed_color.lightened(0.5));
}
p_theme->set_stylebox("normal", "EditorLogFilterButton", style_flat_button);
p_theme->set_stylebox("hover", "EditorLogFilterButton", style_flat_button_hover);
p_theme->set_stylebox("pressed", "EditorLogFilterButton", editor_log_button_pressed);
Expand Down

0 comments on commit db61cf8

Please sign in to comment.