6565#include " scene/main/timer.h"
6666#include " scene/main/window.h"
6767#include " scene/property_utils.h"
68+ #include " scene/resources/dpi_texture.h"
6869#include " scene/resources/image_texture.h"
6970#include " scene/resources/packed_scene.h"
7071#include " scene/resources/portable_compressed_texture.h"
166167#include " editor/settings/project_settings_editor.h"
167168#include " editor/shader/editor_native_shader_source_visualizer.h"
168169#include " editor/shader/visual_shader_editor_plugin.h"
170+ #include " editor/themes/editor_color_map.h"
169171#include " editor/themes/editor_scale.h"
170172#include " editor/themes/editor_theme_manager.h"
171173#include " editor/translations/editor_translation_parser.h"
@@ -683,10 +685,10 @@ void EditorNode::_update_theme(bool p_skip_creation) {
683685 distraction_free->set_button_icon (theme->get_icon (SNAME (" DistractionFree" ), EditorStringName (EditorIcons)));
684686 update_distraction_free_button_theme ();
685687
686- help_menu->set_item_icon (help_menu->get_item_index (HELP_SEARCH), _get_editor_theme_native_menu_icon (SNAME (" HelpSearch" ), global_menu, dark_mode));
687- help_menu->set_item_icon (help_menu->get_item_index (HELP_COPY_SYSTEM_INFO), _get_editor_theme_native_menu_icon (SNAME (" ActionCopy" ), global_menu, dark_mode));
688- help_menu->set_item_icon (help_menu->get_item_index (HELP_ABOUT), _get_editor_theme_native_menu_icon (SNAME (" Godot" ), global_menu, dark_mode));
689- help_menu->set_item_icon (help_menu->get_item_index (HELP_SUPPORT_GODOT_DEVELOPMENT), _get_editor_theme_native_menu_icon (SNAME (" Heart" ), global_menu, dark_mode));
688+ help_menu->set_item_icon (help_menu->get_item_index (HELP_SEARCH), get_editor_theme_native_menu_icon (SNAME (" HelpSearch" ), global_menu, dark_mode));
689+ help_menu->set_item_icon (help_menu->get_item_index (HELP_COPY_SYSTEM_INFO), get_editor_theme_native_menu_icon (SNAME (" ActionCopy" ), global_menu, dark_mode));
690+ help_menu->set_item_icon (help_menu->get_item_index (HELP_ABOUT), get_editor_theme_native_menu_icon (SNAME (" Godot" ), global_menu, dark_mode));
691+ help_menu->set_item_icon (help_menu->get_item_index (HELP_SUPPORT_GODOT_DEVELOPMENT), get_editor_theme_native_menu_icon (SNAME (" Heart" ), global_menu, dark_mode));
690692
691693 _update_renderer_color ();
692694 }
@@ -703,16 +705,27 @@ void EditorNode::_update_theme(bool p_skip_creation) {
703705#endif
704706}
705707
706- Ref<Texture2D> EditorNode::_get_editor_theme_native_menu_icon (const StringName &p_name, bool p_global_menu, bool p_dark_mode) const {
707- if (!p_global_menu) {
708- return theme->get_icon (p_name, SNAME (" EditorIcons" ));
708+ Ref<Texture2D> EditorNode::get_editor_theme_native_menu_icon (const StringName &p_name, bool p_global_menu, bool p_dark_mode) const {
709+ Ref<Texture2D> tx = theme->get_icon (p_name, SNAME (" EditorIcons" ));
710+ if (!p_global_menu || p_dark_mode == EditorThemeManager::is_dark_icon_and_font ()) {
711+ return tx;
709712 }
710- if (p_dark_mode && theme-> has_icon ( String (p_name) + " Dark " , SNAME ( " EditorIcons " ))) {
711- return theme-> get_icon ( String (p_name) + " Dark " , SNAME ( " EditorIcons " )) ;
712- } else if (!p_dark_mode && theme-> has_icon ( String (p_name) + " Light " , SNAME ( " EditorIcons " ) )) {
713- return theme-> get_icon ( String (p_name) + " Light " , SNAME ( " EditorIcons " )) ;
713+
714+ Ref<DPITexture> new_tx = tx ;
715+ if (new_tx. is_null ( )) {
716+ return tx ;
714717 }
715- return theme->get_icon (p_name, SNAME (" EditorIcons" ));
718+ new_tx = new_tx->duplicate ();
719+
720+ Dictionary color_conversion_map;
721+ if (!p_dark_mode) {
722+ for (KeyValue<Color, Color> &E : EditorColorMap::get_color_conversion_map ()) {
723+ color_conversion_map[E.key ] = E.value ;
724+ }
725+ }
726+ new_tx->set_color_map (color_conversion_map);
727+
728+ return new_tx;
716729}
717730
718731void EditorNode::update_preview_themes (int p_mode) {
@@ -3905,10 +3918,10 @@ void EditorNode::_check_system_theme_changed() {
39053918 // Update system menus.
39063919 bool dark_mode = DisplayServer::get_singleton ()->is_dark_mode ();
39073920
3908- help_menu->set_item_icon (help_menu->get_item_index (HELP_SEARCH), _get_editor_theme_native_menu_icon (SNAME (" HelpSearch" ), global_menu, dark_mode));
3909- help_menu->set_item_icon (help_menu->get_item_index (HELP_COPY_SYSTEM_INFO), _get_editor_theme_native_menu_icon (SNAME (" ActionCopy" ), global_menu, dark_mode));
3910- help_menu->set_item_icon (help_menu->get_item_index (HELP_ABOUT), _get_editor_theme_native_menu_icon (SNAME (" Godot" ), global_menu, dark_mode));
3911- help_menu->set_item_icon (help_menu->get_item_index (HELP_SUPPORT_GODOT_DEVELOPMENT), _get_editor_theme_native_menu_icon (SNAME (" Heart" ), global_menu, dark_mode));
3921+ help_menu->set_item_icon (help_menu->get_item_index (HELP_SEARCH), get_editor_theme_native_menu_icon (SNAME (" HelpSearch" ), global_menu, dark_mode));
3922+ help_menu->set_item_icon (help_menu->get_item_index (HELP_COPY_SYSTEM_INFO), get_editor_theme_native_menu_icon (SNAME (" ActionCopy" ), global_menu, dark_mode));
3923+ help_menu->set_item_icon (help_menu->get_item_index (HELP_ABOUT), get_editor_theme_native_menu_icon (SNAME (" Godot" ), global_menu, dark_mode));
3924+ help_menu->set_item_icon (help_menu->get_item_index (HELP_SUPPORT_GODOT_DEVELOPMENT), get_editor_theme_native_menu_icon (SNAME (" Heart" ), global_menu, dark_mode));
39123925 editor_dock_manager->update_docks_menu ();
39133926 }
39143927}
@@ -8636,23 +8649,23 @@ EditorNode::EditorNode() {
86368649
86378650 ED_SHORTCUT_AND_COMMAND (" editor/editor_help" , TTRC (" Search Help..." ), Key::F1);
86388651 ED_SHORTCUT_OVERRIDE (" editor/editor_help" , " macos" , KeyModifierMask::ALT | Key::SPACE);
8639- help_menu->add_icon_shortcut (_get_editor_theme_native_menu_icon (SNAME (" HelpSearch" ), global_menu, dark_mode), ED_GET_SHORTCUT (" editor/editor_help" ), HELP_SEARCH);
8652+ help_menu->add_icon_shortcut (get_editor_theme_native_menu_icon (SNAME (" HelpSearch" ), global_menu, dark_mode), ED_GET_SHORTCUT (" editor/editor_help" ), HELP_SEARCH);
86408653 help_menu->add_separator ();
86418654 help_menu->add_shortcut (ED_SHORTCUT_AND_COMMAND (" editor/online_docs" , TTRC (" Online Documentation" )), HELP_DOCS);
86428655 help_menu->add_shortcut (ED_SHORTCUT_AND_COMMAND (" editor/forum" , TTRC (" Forum" )), HELP_FORUM);
86438656 help_menu->add_shortcut (ED_SHORTCUT_AND_COMMAND (" editor/community" , TTRC (" Community" )), HELP_COMMUNITY);
86448657 help_menu->add_separator ();
8645- help_menu->add_icon_shortcut (_get_editor_theme_native_menu_icon (SNAME (" ActionCopy" ), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND (" editor/copy_system_info" , TTRC (" Copy System Info" )), HELP_COPY_SYSTEM_INFO);
8658+ help_menu->add_icon_shortcut (get_editor_theme_native_menu_icon (SNAME (" ActionCopy" ), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND (" editor/copy_system_info" , TTRC (" Copy System Info" )), HELP_COPY_SYSTEM_INFO);
86468659 help_menu->set_item_tooltip (-1 , TTR (" Copies the system info as a single-line text into the clipboard." ));
86478660 help_menu->add_shortcut (ED_SHORTCUT_AND_COMMAND (" editor/report_a_bug" , TTRC (" Report a Bug" )), HELP_REPORT_A_BUG);
86488661 help_menu->add_shortcut (ED_SHORTCUT_AND_COMMAND (" editor/suggest_a_feature" , TTRC (" Suggest a Feature" )), HELP_SUGGEST_A_FEATURE);
86498662 help_menu->add_shortcut (ED_SHORTCUT_AND_COMMAND (" editor/send_docs_feedback" , TTRC (" Send Docs Feedback" )), HELP_SEND_DOCS_FEEDBACK);
86508663 help_menu->add_separator ();
86518664 if (!global_menu || !OS::get_singleton ()->has_feature (" macos" )) {
86528665 // On macOS "Quit" and "About" options are in the "app" menu.
8653- help_menu->add_icon_shortcut (_get_editor_theme_native_menu_icon (SNAME (" Godot" ), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND (" editor/about" , TTRC (" About Godot..." )), HELP_ABOUT);
8666+ help_menu->add_icon_shortcut (get_editor_theme_native_menu_icon (SNAME (" Godot" ), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND (" editor/about" , TTRC (" About Godot..." )), HELP_ABOUT);
86548667 }
8655- help_menu->add_icon_shortcut (_get_editor_theme_native_menu_icon (SNAME (" Heart" ), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND (" editor/support_development" , TTRC (" Support Godot Development" )), HELP_SUPPORT_GODOT_DEVELOPMENT);
8668+ help_menu->add_icon_shortcut (get_editor_theme_native_menu_icon (SNAME (" Heart" ), global_menu, dark_mode), ED_SHORTCUT_AND_COMMAND (" editor/support_development" , TTRC (" Support Godot Development" )), HELP_SUPPORT_GODOT_DEVELOPMENT);
86568669
86578670 // Spacer to center 2D / 3D / Script buttons.
86588671 right_spacer = memnew (Control);
0 commit comments