diff --git a/tools/common/include/commoneditor.hpp b/tools/common/include/commoneditor.hpp index 0c74b36..87a5d29 100755 --- a/tools/common/include/commoneditor.hpp +++ b/tools/common/include/commoneditor.hpp @@ -227,6 +227,7 @@ public: const float inner_spacing = ImGui::GetStyle().ItemInnerSpacing.x; const auto frame_color = ImGui::GetStyle().Colors[ImGuiCol_FrameBg]; + const auto text_color = ImGui::GetStyle().Colors[ImGuiCol_Text]; const ImRect edit_rect = ImRect(window_pos, ImVec2(window_pos.x + thumbnail_size, window_pos.y + thumbnail_size)); @@ -235,7 +236,7 @@ public: ImRect path_rect = ImRect(ImVec2(window_pos.x + thumbnail_size + 10.0f, window_pos.y), ImVec2(window_pos.x + item_width - inner_spacing, window_pos.y + 20.0f)); - draw_list->AddText(ImVec2(window_pos.x + item_width, window_pos.y + (thumbnail_size / 2.0f) - (line_height / 2.0f)), ImColor(255, 255, 255, 255), name); + draw_list->AddText(ImVec2(window_pos.x + item_width, window_pos.y + (thumbnail_size / 2.0f) - (line_height / 2.0f)), ImColor(text_color), name); draw_list->AddRectFilled(path_rect.Min, path_rect.Max, ImColor(frame_color), 3.0f); @@ -251,7 +252,7 @@ public: ImGui::PushClipRect(path_rect.Min, path_rect.Max, false); - draw_list->AddText(ImVec2(window_pos.x + thumbnail_size + 10.0f, window_pos.y), ImColor(255, 255, 255, 255), path.c_str()); + draw_list->AddText(ImVec2(window_pos.x + thumbnail_size + 10.0f, window_pos.y), ImColor(text_color), path.c_str()); ImGui::Dummy(ImVec2(thumbnail_size, thumbnail_size + 10.0f)); @@ -270,9 +271,8 @@ public: ImGui::ItemAdd(edit_rect, ImGui::GetID("edit")); - if(ImGui::IsItemClicked()) { + if(ImGui::IsItemClicked()) asset_selected(asset->path, get_asset_type()); - } ImGui::ItemAdd(clear_rect, ImGui::GetID("clear")); diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index e090784..08ab910 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -345,7 +345,10 @@ void CommonEditor::walkObject(Object object, Object) { if(data.editor_object) return; - ImGui::PushStyleColor(ImGuiCol_Text, selected_object == object ? ImVec4(0.0, 0.0, 1.0, 1.0) : ImVec4(1.0, 1.0, 1.0, 1.0)); + const auto text_color = ImGui::GetStyle().Colors[ImGuiCol_Text]; + const auto active_color = ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]; + + ImGui::PushStyleColor(ImGuiCol_Text, selected_object == object ? active_color : text_color); bool is_open = ImGui::TreeNodeEx((void*)object, base_flags, "%s", data.name.c_str());