From 33aebfb89d6dc253f9ee0b5a0bde176528316ddb Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 20 Jun 2022 13:05:50 +0200 Subject: [PATCH] ImGui theme improvements --- r5dev/gameui/IBrowser.cpp | 12 +++++++----- r5dev/gameui/IConsole.cpp | 12 +++++++----- r5dev/thirdparty/imgui/src/imgui_logger.cpp | 14 +++++++------- r5dev/thirdparty/imgui/src/imgui_widgets.cpp | 3 +++ 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/r5dev/gameui/IBrowser.cpp b/r5dev/gameui/IBrowser.cpp index d75fcc5f..1ace5741 100644 --- a/r5dev/gameui/IBrowser.cpp +++ b/r5dev/gameui/IBrowser.cpp @@ -736,6 +736,7 @@ void CBrowser::SetStyleVar(void) { colors[ImGuiCol_Text] = ImVec4(0.81f, 0.81f, 0.81f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.56f, 0.56f, 0.56f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.13f, 0.38f, 0.63f, 0.50f); colors[ImGuiCol_WindowBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f); colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f); @@ -786,12 +787,13 @@ void CBrowser::SetStyleVar(void) } else { - colors[ImGuiCol_WindowBg] = ImVec4(0.11f, 0.13f, 0.17f, 1.00f); - colors[ImGuiCol_ChildBg] = ImVec4(0.02f, 0.04f, 0.06f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.13f, 0.38f, 0.63f, 0.50f); + colors[ImGuiCol_WindowBg] = ImVec4(0.12f, 0.14f, 0.19f, 1.00f); + colors[ImGuiCol_ChildBg] = ImVec4(0.03f, 0.05f, 0.09f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.13f, 0.17f, 1.00f); - colors[ImGuiCol_Border] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f); + colors[ImGuiCol_Border] = ImVec4(0.61f, 0.61f, 0.61f, 0.50f); colors[ImGuiCol_BorderShadow] = ImVec4(0.04f, 0.04f, 0.04f, 0.00f); - colors[ImGuiCol_FrameBg] = ImVec4(0.02f, 0.04f, 0.06f, 1.00f); + colors[ImGuiCol_FrameBg] = ImVec4(0.03f, 0.05f, 0.09f, 1.00f); colors[ImGuiCol_FrameBgHovered] = ImVec4(0.04f, 0.06f, 0.10f, 1.00f); colors[ImGuiCol_FrameBgActive] = ImVec4(0.04f, 0.07f, 0.12f, 1.00f); colors[ImGuiCol_TitleBg] = ImVec4(0.26f, 0.51f, 0.78f, 1.00f); @@ -810,7 +812,7 @@ void CBrowser::SetStyleVar(void) colors[ImGuiCol_HeaderHovered] = ImVec4(0.38f, 0.53f, 0.53f, 1.00f); colors[ImGuiCol_HeaderActive] = ImVec4(0.41f, 0.56f, 0.57f, 1.00f); colors[ImGuiCol_Separator] = ImVec4(0.53f, 0.53f, 0.57f, 0.00f); - colors[ImGuiCol_ResizeGrip] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f); + colors[ImGuiCol_ResizeGrip] = ImVec4(0.81f, 0.81f, 0.81f, 0.50f); colors[ImGuiCol_Tab] = ImVec4(0.31f, 0.43f, 0.43f, 1.00f); colors[ImGuiCol_TabHovered] = ImVec4(0.38f, 0.53f, 0.53f, 1.00f); colors[ImGuiCol_TabActive] = ImVec4(0.41f, 0.56f, 0.57f, 1.00f); diff --git a/r5dev/gameui/IConsole.cpp b/r5dev/gameui/IConsole.cpp index 225d6180..c6645aa3 100644 --- a/r5dev/gameui/IConsole.cpp +++ b/r5dev/gameui/IConsole.cpp @@ -821,6 +821,7 @@ void CConsole::SetStyleVar(void) { colors[ImGuiCol_Text] = ImVec4(0.81f, 0.81f, 0.81f, 1.00f); colors[ImGuiCol_TextDisabled] = ImVec4(0.56f, 0.56f, 0.56f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.13f, 0.38f, 0.63f, 0.50f); colors[ImGuiCol_WindowBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f); colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.27f, 0.27f, 0.27f, 1.00f); @@ -871,12 +872,13 @@ void CConsole::SetStyleVar(void) } else { - colors[ImGuiCol_WindowBg] = ImVec4(0.11f, 0.13f, 0.17f, 1.00f); - colors[ImGuiCol_ChildBg] = ImVec4(0.02f, 0.04f, 0.06f, 1.00f); + colors[ImGuiCol_TextSelectedBg] = ImVec4(0.13f, 0.38f, 0.63f, 0.50f); + colors[ImGuiCol_WindowBg] = ImVec4(0.12f, 0.14f, 0.19f, 1.00f); + colors[ImGuiCol_ChildBg] = ImVec4(0.03f, 0.05f, 0.09f, 1.00f); colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.13f, 0.17f, 1.00f); - colors[ImGuiCol_Border] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f); + colors[ImGuiCol_Border] = ImVec4(0.61f, 0.61f, 0.61f, 0.50f); colors[ImGuiCol_BorderShadow] = ImVec4(0.04f, 0.04f, 0.04f, 0.00f); - colors[ImGuiCol_FrameBg] = ImVec4(0.02f, 0.04f, 0.06f, 1.00f); + colors[ImGuiCol_FrameBg] = ImVec4(0.03f, 0.05f, 0.09f, 1.00f); colors[ImGuiCol_FrameBgHovered] = ImVec4(0.04f, 0.06f, 0.10f, 1.00f); colors[ImGuiCol_FrameBgActive] = ImVec4(0.04f, 0.07f, 0.12f, 1.00f); colors[ImGuiCol_TitleBg] = ImVec4(0.26f, 0.51f, 0.78f, 1.00f); @@ -895,7 +897,7 @@ void CConsole::SetStyleVar(void) colors[ImGuiCol_HeaderHovered] = ImVec4(0.38f, 0.53f, 0.53f, 1.00f); colors[ImGuiCol_HeaderActive] = ImVec4(0.41f, 0.56f, 0.57f, 1.00f); colors[ImGuiCol_Separator] = ImVec4(0.53f, 0.53f, 0.57f, 0.00f); - colors[ImGuiCol_ResizeGrip] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f); + colors[ImGuiCol_ResizeGrip] = ImVec4(0.81f, 0.81f, 0.81f, 0.50f); colors[ImGuiCol_Tab] = ImVec4(0.31f, 0.43f, 0.43f, 1.00f); colors[ImGuiCol_TabHovered] = ImVec4(0.38f, 0.53f, 0.53f, 1.00f); colors[ImGuiCol_TabActive] = ImVec4(0.41f, 0.56f, 0.57f, 1.00f); diff --git a/r5dev/thirdparty/imgui/src/imgui_logger.cpp b/r5dev/thirdparty/imgui/src/imgui_logger.cpp index 0619f907..a39a00bd 100644 --- a/r5dev/thirdparty/imgui/src/imgui_logger.cpp +++ b/r5dev/thirdparty/imgui/src/imgui_logger.cpp @@ -781,7 +781,7 @@ void CTextLogger::Render() { ImVec2 vstart(lineStartScreenPos.x + m_flTextStart + sstart, lineStartScreenPos.y); ImVec2 vend(lineStartScreenPos.x + m_flTextStart + ssend, lineStartScreenPos.y + m_CharAdvance.y); - drawList->AddRectFilled(vstart, vend, 0x80a06020); // COLOR + drawList->AddRectFilled(vstart, vend, ImGui::GetColorU32(ImGuiCol_TextSelectedBg)); } if (m_State.m_CursorPosition.m_nLine == lineNo) @@ -790,12 +790,12 @@ void CTextLogger::Render() ImVec2 start = ImVec2(lineStartScreenPos.x + scrollX, lineStartScreenPos.y); // Highlight the current line (where the cursor is) - if (!HasSelection()) - { - auto end = ImVec2(start.x + contentSize.x + scrollX, start.y + m_CharAdvance.y); - drawList->AddRectFilled(start, end, 0x40000000); - drawList->AddRect(start, end, 0x40000000, 1.0f); - } + //if (!HasSelection()) + //{ + // auto end = ImVec2(start.x + contentSize.x + scrollX, start.y + m_CharAdvance.y); + // drawList->AddRectFilled(start, end, 0x80a06020); + // drawList->AddRect(start, end, 0x80a06020, 1.0f); + //} // Render the cursor if (focused) diff --git a/r5dev/thirdparty/imgui/src/imgui_widgets.cpp b/r5dev/thirdparty/imgui/src/imgui_widgets.cpp index 0ab63db0..7fde8f40 100644 --- a/r5dev/thirdparty/imgui/src/imgui_widgets.cpp +++ b/r5dev/thirdparty/imgui/src/imgui_widgets.cpp @@ -4691,7 +4691,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_ ImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn)); rect.ClipWith(clip_rect); if (rect.Overlaps(clip_rect)) + { + draw_window->DrawList->AddRect(rect.Min, rect.Max, bg_color, 1.0f); draw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color); + } } rect_pos.x = draw_pos.x - draw_scroll.x; rect_pos.y += g.FontSize;