From 3765c6aed4f66ac05699c3f14fb485a50c5ee436 Mon Sep 17 00:00:00 2001 From: "xiangdong.yang" Date: Wed, 10 Aug 2022 14:31:17 +0800 Subject: [PATCH] ENH:Add color for XYZ Change-Id: I4aa5c5edb35c934906bcd5f848e23e5250023f3a --- src/imgui/imgui_widgets.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/imgui/imgui_widgets.cpp b/src/imgui/imgui_widgets.cpp index c363347e5..b14c26487 100644 --- a/src/imgui/imgui_widgets.cpp +++ b/src/imgui/imgui_widgets.cpp @@ -283,7 +283,15 @@ void ImGui::TextAlignCenter(const char *label) float item_width = ImGui::CalcItemWidth(); float font_size = ImGui::GetFontSize() * strlen(label) / 2; ImGui::SameLine(ImGui::GetCursorPos().x + (item_width - font_size) / 2); - ImGui::Text(label); + + if ('X' == *label) + ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0),label); + else if ('Y' == *label) + ImGui::TextColored(ImVec4(0.0, 0.6, 0.2, 1.0),label); + else if ('Z' == *label) + ImGui::TextColored(ImVec4(0.0, 0.0, 1.0, 1.0),label); + else + ImGui::Text(label); } void ImGui::TextV(const char* fmt, va_list args)