Skip to content

Commit a211c1f

Browse files
committed
Adds light theme
1 parent 39b1139 commit a211c1f

File tree

3 files changed

+97
-6
lines changed

3 files changed

+97
-6
lines changed

editor/editor_system.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,12 @@ bool EditorSystem::initialize(const JSON::json& systemData)
9696
}
9797
ImGui_ImplWin32_Init(Application::GetSingleton()->getWindow()->getWindowHandle());
9898
ImGui_ImplDX11_Init(RenderingDevice::GetSingleton()->getDevice(), RenderingDevice::GetSingleton()->getContext());
99-
99+
100100
m_Themes.push_back(std::make_unique<DarkTheme>());
101+
m_Themes.push_back(std::make_unique<LightTheme>());
101102
m_CurrentTheme = m_Themes.front().get();
102103
m_CurrentTheme->apply();
103-
104+
104105
return true;
105106
}
106107

@@ -923,18 +924,18 @@ int EditorSystem::exportScene(const String& sceneName, const String& sceneFilePa
923924

924925
for (auto& filePair : toCopy)
925926
{
926-
tasks.push_back(std::make_shared<Task>([=, &progress]() {
927+
tasks.push_back(std::make_shared<Task>([=, &progress]()
928+
{
927929
progress++;
928930
if (m_IsCopyFailed)
929931
{
930932
return;
931933
}
932-
m_IsCopyFailed = !OS::RelativeCopyFile(filePair.first, m_CurrExportDir + filePair.second);
933-
}));
934+
m_IsCopyFailed = !OS::RelativeCopyFile(filePair.first, m_CurrExportDir + filePair.second); }));
934935
}
935936

936937
/// TODO: Fix the need for this dummy task (blocks the main thread while tasks are running)
937-
tasks.push_back(std::make_shared<Task>([]() {}));
938+
tasks.push_back(std::make_shared<Task>([]() { }));
938939
progress++;
939940

940941
ThreadPool& threadPool = Application::GetSingleton()->getThreadPool();

editor/editor_system.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include "themes/theme.h"
1515
#include "themes/dark_theme.h"
16+
#include "themes/light_theme.h"
1617

1718
ImColor ColorToImColor(Color& c);
1819

editor/themes/light_theme.h

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#pragma once
2+
3+
#include "theme.h"
4+
5+
class LightTheme : public Theme
6+
{
7+
public:
8+
void apply() const override
9+
{
10+
ImGui::StyleColorsLight();
11+
ImGuiStyle& style = ImGui::GetStyle();
12+
13+
// Layout
14+
style.WindowPadding = ImVec2(15, 15);
15+
style.WindowRounding = 5.0f;
16+
style.FramePadding = ImVec2(5, 5);
17+
style.FrameRounding = 4.0f;
18+
style.ItemSpacing = ImVec2(12, 6);
19+
style.ItemInnerSpacing = ImVec2(8, 4);
20+
style.IndentSpacing = 25.0f;
21+
style.ScrollbarSize = 15.0f;
22+
style.ScrollbarRounding = 9.0f;
23+
style.GrabMinSize = 5.0f;
24+
style.GrabRounding = 3.0f;
25+
26+
// Colors
27+
ImVec4* colors = style.Colors;
28+
colors[ImGuiCol_Text] = ImVec4(0.10f, 0.10f, 0.10f, 1.00f);
29+
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
30+
colors[ImGuiCol_WindowBg] = ImVec4(0.95f, 0.96f, 0.98f, 1.00f);
31+
colors[ImGuiCol_ChildBg] = ImVec4(0.98f, 0.98f, 0.98f, 1.00f);
32+
colors[ImGuiCol_PopupBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);
33+
colors[ImGuiCol_Border] = ImVec4(0.70f, 0.70f, 0.70f, 0.50f);
34+
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
35+
colors[ImGuiCol_FrameBg] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
36+
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
37+
colors[ImGuiCol_FrameBgActive] = ImVec4(0.65f, 0.65f, 0.65f, 1.00f);
38+
colors[ImGuiCol_TitleBg] = ImVec4(0.86f, 0.86f, 0.90f, 1.00f);
39+
colors[ImGuiCol_TitleBgActive] = ImVec4(0.75f, 0.75f, 0.80f, 1.00f);
40+
colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.95f, 0.95f, 0.95f, 0.50f);
41+
colors[ImGuiCol_MenuBarBg] = ImVec4(0.92f, 0.92f, 0.95f, 1.00f);
42+
colors[ImGuiCol_ScrollbarBg] = ImVec4(0.95f, 0.95f, 0.96f, 1.00f);
43+
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.75f, 0.75f, 0.80f, 0.60f);
44+
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.65f, 0.65f, 0.70f, 0.80f);
45+
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.60f, 0.60f, 0.65f, 1.00f);
46+
colors[ImGuiCol_CheckMark] = ImVec4(0.25f, 0.50f, 0.75f, 1.00f);
47+
colors[ImGuiCol_SliderGrab] = ImVec4(0.60f, 0.60f, 0.70f, 0.50f);
48+
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.25f, 0.50f, 0.75f, 1.00f);
49+
colors[ImGuiCol_Button] = ImVec4(0.75f, 0.75f, 0.85f, 1.00f);
50+
colors[ImGuiCol_ButtonHovered] = ImVec4(0.85f, 0.85f, 0.95f, 1.00f);
51+
colors[ImGuiCol_ButtonActive] = ImVec4(0.65f, 0.65f, 0.90f, 1.00f);
52+
colors[ImGuiCol_Header] = ImVec4(0.80f, 0.80f, 0.90f, 1.00f);
53+
colors[ImGuiCol_HeaderHovered] = ImVec4(0.85f, 0.85f, 0.95f, 1.00f);
54+
colors[ImGuiCol_HeaderActive] = ImVec4(0.65f, 0.65f, 0.85f, 1.00f);
55+
colors[ImGuiCol_Separator] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
56+
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.30f, 0.60f, 0.90f, 1.00f);
57+
colors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.50f, 0.80f, 1.00f);
58+
colors[ImGuiCol_ResizeGrip] = ImVec4(0.90f, 0.90f, 0.90f, 0.30f);
59+
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.60f, 0.60f, 0.70f, 0.60f);
60+
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.30f, 0.60f, 0.90f, 1.00f);
61+
colors[ImGuiCol_Tab] = ImVec4(0.80f, 0.80f, 0.85f, 1.00f);
62+
colors[ImGuiCol_TabHovered] = ImVec4(0.90f, 0.90f, 0.95f, 1.00f);
63+
colors[ImGuiCol_TabActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
64+
colors[ImGuiCol_TabUnfocused] = ImVec4(0.92f, 0.92f, 0.92f, 0.90f);
65+
colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.75f, 0.75f, 0.85f, 1.00f);
66+
colors[ImGuiCol_DockingPreview] = ImVec4(0.30f, 0.60f, 0.90f, 0.70f);
67+
colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);
68+
colors[ImGuiCol_PlotLines] = ImVec4(0.35f, 0.35f, 0.35f, 1.00f);
69+
colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 0.50f, 0.75f, 1.00f);
70+
colors[ImGuiCol_PlotHistogram] = ImVec4(0.30f, 0.45f, 0.60f, 1.00f);
71+
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 0.50f, 0.75f, 1.00f);
72+
colors[ImGuiCol_TableHeaderBg] = ImVec4(0.85f, 0.85f, 0.90f, 1.00f);
73+
colors[ImGuiCol_TableBorderStrong] = ImVec4(0.70f, 0.70f, 0.75f, 1.00f);
74+
colors[ImGuiCol_TableBorderLight] = ImVec4(0.85f, 0.85f, 0.90f, 1.00f);
75+
colors[ImGuiCol_TableRowBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.00f);
76+
colors[ImGuiCol_TableRowBgAlt] = ImVec4(0.95f, 0.95f, 0.95f, 0.30f);
77+
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.30f, 0.60f, 0.90f, 0.50f);
78+
colors[ImGuiCol_DragDropTarget] = ImVec4(0.00f, 0.60f, 1.00f, 0.90f);
79+
colors[ImGuiCol_NavHighlight] = ImVec4(0.30f, 0.60f, 0.90f, 1.00f);
80+
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.30f, 0.60f, 0.90f, 0.70f);
81+
colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
82+
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.90f, 0.90f, 0.90f, 0.60f);
83+
}
84+
85+
String getName() const override
86+
{
87+
return "Light";
88+
}
89+
};

0 commit comments

Comments
 (0)