Skip to content
Snippets Groups Projects
Commit 6a5f4cda authored by Adam Nyberg's avatar Adam Nyberg
Browse files

Added nicer ImGUI theme, just for fun, completly unnecessary

parent 714bd6b9
No related branches found
No related tags found
No related merge requests found
......@@ -10,6 +10,64 @@
#include "include/FluidSimulationApp.h"
void SetCustomImGuiTheme()
{
ImGuiStyle& style = ImGui::GetStyle();
// General spacing and rounding for a clean look
style.TabRounding = 2.0f; // Subtle rounding
style.WindowRounding = 3.0f; // Slight rounding for dockable windows
style.ChildRounding = 2.0f; // Consistent with tabs
style.PopupRounding = 2.0f;
style.FrameRounding = 3.0f; // For sliders and buttons
style.GrabRounding = 2.0f; // For slider knobs
style.WindowPadding = ImVec2(4, 4);
style.FramePadding = ImVec2(4, 4);
style.ItemSpacing = ImVec2(12, 8);
style.ScrollbarSize = 15.0f;
// Blender/Unity-like Colors (Darker gray with contrasting highlights)
ImVec4* colors = style.Colors;
// Tab colors
colors[ImGuiCol_Tab] = ImVec4(0.18f, 0.18f, 0.18f, 1.00f); // Neutral dark gray
colors[ImGuiCol_TabHovered] = ImVec4(0.28f, 0.28f, 0.28f, 1.00f); // Slightly lighter when hovered
colors[ImGuiCol_TabActive] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f); // Active tab
colors[ImGuiCol_TabUnfocused] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Background tabs
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Active but unfocused tab
// Docking preview highlight (less intrusive)
colors[ImGuiCol_DockingPreview] = ImVec4(0.10f, 0.10f, 0.10f, 0.70f);
// Window borders and docking separators
colors[ImGuiCol_Border] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Subtle border
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); // No shadow
// Remove overly bright lines on docking highlights
colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f); // White text
colors[ImGuiCol_WindowBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f); // Dark gray background
colors[ImGuiCol_Border] = ImVec4(0.29f, 0.29f, 0.29f, 0.50f); // Soft borders
colors[ImGuiCol_FrameBg] = ImVec4(0.21f, 0.21f, 0.21f, 1.00f); // Input background
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.33f, 0.33f, 0.33f, 1.00f); // Hover effect
colors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f); // Active field
colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); // Title bar
colors[ImGuiCol_TitleBgActive] = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Active title bar
colors[ImGuiCol_Button] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Buttons
colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f); // Hovered buttons
colors[ImGuiCol_ButtonActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); // Active buttons
colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Collapsible headers
colors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.26f, 0.26f, 1.00f);
colors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f);
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f);
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
colors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f); // Checkbox mark
}
void GLFWKeyCallback(GLFWwindow* window, int key, int scancode, int action, int mods) {
// Retrieve FluidSimulatorApp from window user pointer
FluidSimulation::FluidSimulatorApp* app = static_cast<FluidSimulation::FluidSimulatorApp*>(glfwGetWindowUserPointer(window));
......@@ -106,8 +164,9 @@ int main(int argc, char** argv) {
fprintf(stderr, "Failed To Load Font \n");
}
// Setup Dear ImGui style
ImGui::StyleColorsDark();
//ImGui::StyleColorsDark();
// ImGui::StyleColorsClassic();
SetCustomImGuiTheme();
// Setup Platform/Renderer backends
ImGui_ImplGlfw_InitForOpenGL(window, true);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment