1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-15 00:44:20 +00:00

Add configurable color for button text in hovered and active states

This commit is contained in:
Justin Li 2022-01-14 19:49:26 -05:00
parent 45c4365ec3
commit 572896a808
4 changed files with 13 additions and 0 deletions

View file

@ -701,8 +701,15 @@ bool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags
if (g.LogEnabled)
LogSetNextTextDecoration("[", "]");
if (hovered)
ImGui::PushStyleColor(ImGuiCol_Text, g.Style.Colors[held ? ImGuiCol_TextButtonActive : ImGuiCol_TextButtonHover]);
RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);
if (hovered)
ImGui::PopStyleColor();
// Automatically close popups
//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))
// CloseCurrentPopup();