#pragma once
#include "Application.hpp"
#include "EntryPoint.hpp"
#include "ColorPicker_Vars.hpp"

#define WND_SIZEX GetSystemMetrics(SM_CXSCREEN)
#define WND_SIZEY GetSystemMetrics(SM_CYSCREEN)

namespace ImGui
{
	static DWORD windowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings;
	static ImVec4 windowBgColor = { 0.55f, 0.55f, 0.55f, 1.00f }; // 0.22f, 0.22f, 0.22f
	static ImVec4 childBgColor = { 0.55f, 0.55f, 0.55f, 1.00f };
	static ImVec4 textColor = { 1.00f, 1.00f, 1.00f, 1.00f };
	static ImVec4 sliderColor = { 1.00f, 1.00f, 1.00f, 1.00f };
	static ImVec4 sliderScrollColor = { 1.00f, 1.00f, 1.00f, 1.00f };
	static ImVec4 textDisabledColor = { 0.50f, 0.50f, 0.50f, 1.00f };
	static ImVec4 transparentColor = { 0.00f, 0.00f, 0.00f, 0.00f };
	static ImVec4 iconColor = ImVec4(ImColor(0, 68, 170, 200));
	static ImVec4 currentColorPicked = { 1.00f, 1.00f, 1.00f, 1.00f };
	static ImVec4 newColorPicked = { 1.00f, 1.00f, 1.00f, 1.00f };
	static ImVec4 newIconColorActive = { 1.00f, 1.00f, 1.00f, 1.00f };
	static ImVec4 newIconColorInactive = { 1.00f, 1.00f, 1.00f, 1.00f };
	static int iRValue = 0;
	static int iGValue = 0;
	static int iBValue = 0;
	ImVec4 active = ImVec4(ImColor(0, 100, 200, 255));
	ImVec4 inactive = ImVec4(ImColor(0, 68, 170, 255));

	static void SetUITheme()
	{
		ImGuiStyle& Style = ImGui::GetStyle();
		Style.WindowPadding = ImVec2(0.00f, 0.00f);
		Style.CellPadding = ImVec2(6.00f, 6.00f);
		Style.ItemSpacing = ImVec2(0.00f, 0.00f);
		Style.ItemInnerSpacing = ImVec2(6.00f, 6.00f);
		Style.TouchExtraPadding = ImVec2(0.00f, 0.00f);
		Style.ScrollbarSize = 15;
		Style.GrabMinSize = 20;
		Style.WindowBorderSize = 0;
		Style.ChildBorderSize = 0;
		Style.PopupBorderSize = 2;
		Style.FrameBorderSize = 0;
		Style.TabBorderSize = 1;
		Style.ChildRounding = 4;
		Style.FrameRounding = 3;
		Style.PopupRounding = 4;
		Style.ScrollbarRounding = 9;
		Style.IndentSpacing = 0;
		Style.GrabRounding = 3;
		Style.LogSliderDeadzone = 4;
		Style.TabRounding = 4;
		Style.Colors[ImGuiCol_Text] = textColor;
		Style.Colors[ImGuiCol_TextDisabled] = textDisabledColor;
		Style.Colors[ImGuiCol_WindowBg] = windowBgColor;
		Style.Colors[ImGuiCol_ChildBg] = childBgColor;
		//Style.Colors[ImGuiCol_PopupBg] = ImVec4(0.19f, 0.19f, 0.19f, 0.92f);
		Style.Colors[ImGuiCol_Border] = ImVec4(0.26f, 0.26f, 0.26f, 1.00f);
		Style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.26f, 0.26f, 0.26f, 1.00f);
		Style.Colors[ImGuiCol_FrameBg] = sliderScrollColor;
		Style.Colors[ImGuiCol_FrameBgHovered] = sliderScrollColor;
		Style.Colors[ImGuiCol_FrameBgActive] = sliderScrollColor;
		//Style.Colors[ImGuiCol_TitleBg] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.06f, 0.06f, 0.06f, 1.00f);
		//Style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
		Style.Colors[ImGuiCol_ScrollbarBg] = sliderScrollColor;
		Style.Colors[ImGuiCol_ScrollbarGrab] = sliderScrollColor;
		Style.Colors[ImGuiCol_ScrollbarGrabHovered] = sliderScrollColor;
		Style.Colors[ImGuiCol_ScrollbarGrabActive] = sliderScrollColor;
		//Style.Colors[ImGuiCol_CheckMark] = ImVec4(1.00f, 0.941f, 0.796f, 1.00f);
		Style.Colors[ImGuiCol_SliderGrab] = sliderColor;
		Style.Colors[ImGuiCol_SliderGrabActive] = sliderColor;
		//Style.Colors[ImGuiCol_Button] = ImVec4(0.592f, 0.137f, 0.00f, 0.54f);
		//Style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.592f, 0.137f, 0.00f, 0.34f);
		//Style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.592f, 0.137f, 0.00f, 0.24f);
		//Style.Colors[ImGuiCol_Header] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
		//Style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.00f, 0.00f, 0.00f, 0.36f);
		//Style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.20f, 0.22f, 0.23f, 0.33f);
		//Style.Colors[ImGuiCol_Separator] = ImVec4(0.063f, 0.00f, 0.02f, 1.00f); // 0.28f, 0.28f, 0.28f, 0.29f
		//Style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.44f, 0.44f, 0.44f, 0.29f);
		//Style.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.40f, 0.44f, 0.47f, 1.00f);
		//Style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.28f, 0.28f, 0.28f, 0.29f);
		//Style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.44f, 0.44f, 0.44f, 0.29f);
		//Style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.40f, 0.44f, 0.47f, 1.00f);
		//Style.Colors[ImGuiCol_Tab] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
		//Style.Colors[ImGuiCol_TabHovered] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
		//Style.Colors[ImGuiCol_TabActive] = ImVec4(0.20f, 0.20f, 0.20f, 0.36f);
		//Style.Colors[ImGuiCol_TabUnfocused] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
		//Style.Colors[ImGuiCol_TabUnfocusedActive] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
		////Style.Colors[ImGuiCol_DockingPreview] = ImVec4(0.33f, 0.67f, 0.86f, 1.00f);
		////Style.Colors[ImGuiCol_DockingEmptyBg] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_PlotHistogram] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
		////Style.Colors[ImGuiCol_PlotHistogram_GRAD] = colToVec(255, 200, 0, 255);
		//Style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_TableHeaderBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
		//Style.Colors[ImGuiCol_TableBorderStrong] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
		//Style.Colors[ImGuiCol_TableBorderLight] = ImVec4(0.28f, 0.28f, 0.28f, 0.29f);
		//Style.Colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
		//Style.Colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);
		//Style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
		//Style.Colors[ImGuiCol_DragDropTarget] = ImVec4(0.33f, 0.67f, 0.86f, 1.00f);
		//Style.Colors[ImGuiCol_NavHighlight] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
		//Style.Colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 0.00f, 0.00f, 0.70f);
		//Style.Colors[ImGuiCol_NavWindowingDimBg] = ImVec4(1.00f, 0.00f, 0.00f, 0.20f);
		//Style.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(1.00f, 0.00f, 0.00f, 0.35f);
	}

	static void SCP(float xPos, float yPos)
	{
		ImGui::SetCursorPos(ImVec2(xPos, yPos));
	}

	static void SCPX(float xPos)
	{
		ImGui::SetCursorPosX(xPos);
	}

	static void SCPY(float yPos)
	{
		ImGui::SetCursorPosY(yPos);
	}

	static float GetX()
	{
		return ImGui::GetContentRegionAvail().x;
	}

	static float GetY()
	{
		return ImGui::GetContentRegionAvail().y;
	}

	static void HoroizontalLine(int newId, ImVec2 size, ImVec2 pos)
	{
		std::string id = ("ImGui_Sauce_line_" + std::to_string(newId));
		ImGui::SCP(pos.x, pos.y);
		{
			ImGui::PushStyleColor(ImGuiCol_ChildBg, childBgColor);
			ImGui::BeginChild(id.c_str(), ImVec2(size.x, size.y), true);
			ImGui::EndChild();
			ImGui::PopStyleColor();
		}
	}

	static void CenterText(const char* text, BOOL newLine)
	{
		ImGui::Spacing();
		ImGui::SameLine((ImGui::GetContentRegionAvail().x / 2) - (ImGui::CalcTextSize(text).x / 2));
		ImGui::Text(text);
		ImGui::Spacing();
		if (newLine)
			ImGui::NewLine();
	}

	static void ButtonIcon(const char* buttonName, int* page, int pageNumber, ImVec2 buttonPos, ImVec2 size)
	{
		ImDrawList* drawList = ImGui::GetWindowDrawList();
		ImU32 colBg;
		ImGui::SCP(buttonPos.x, buttonPos.y);
		ImGui::InvisibleButton(buttonName, size);
		if (ImGui::IsItemClicked())
			*page = pageNumber;

		if (ImGui::IsItemHovered())
			colBg = ImGui::GetColorU32(ImGui::newIconColorActive);
		else
			colBg = ImGui::GetColorU32(ImGui::newIconColorInactive);

		ImGui::PushFont(ImGui::FA3);
		ImGui::SCP(buttonPos.x, buttonPos.y + 5.f);
		ImVec2 textPos = ImGui::GetCursorScreenPos();
		const char* text = buttonName;
		drawList->AddText(textPos, colBg, text, text + strlen(text));
		ImGui::PopFont();
	}

	static void ButtonIcon2(const char* buttonName, bool* featureBool, ImVec2 buttonPos, ImVec2 size)
	{
		ImDrawList* drawList = ImGui::GetWindowDrawList();
		ImU32 colBg;
		ImGui::SCP(buttonPos.x, buttonPos.y);
		ImGui::InvisibleButton(buttonName, size);
		if (ImGui::IsItemClicked())
			*featureBool = !*featureBool;

		if (ImGui::IsItemHovered())
		{
			ColorPicker::bEyeDropperHovered = true;
			colBg = ImGui::GetColorU32(ImGui::newIconColorActive);
		}
		else
		{
			ColorPicker::bEyeDropperHovered = false;
			colBg = ImGui::GetColorU32(ImGui::newIconColorInactive);
		}
			

		ImGui::PushFont(ImGui::FA3);
		ImGui::SCP(buttonPos.x, buttonPos.y + 5.f);
		ImVec2 textPos = ImGui::GetCursorScreenPos();
		const char* text = buttonName;
		drawList->AddText(textPos, colBg, text, text + strlen(text));
		ImGui::PopFont();
	}

	static void ButtonIndicator(ImVec2 buttonPos)
	{
		if (ColorPicker::iTab == 0)
		{
			ImGui::PushStyleColor(ImGuiCol_Button, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonActive, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonHovered, active);
			ImGui::PushStyleColor(ImGuiCol_Border, active);
			ImGui::SameLine();
			ImGui::SCP(buttonPos.x - 25.5f, buttonPos.y + 12);
			ImGui::Button("##Window1", ImVec2(5, 25));
			ImGui::PopStyleColor(4);
		}
		if (ColorPicker::iTab == 1)
		{
			ImGui::PushStyleColor(ImGuiCol_Button, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonActive, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonHovered, active);
			ImGui::PushStyleColor(ImGuiCol_Border, active);
			ImGui::SameLine();
			ImGui::SCP(buttonPos.x - 25.5f, buttonPos.y + 12);
			ImGui::Button("##Window2", ImVec2(5, 25));
			ImGui::PopStyleColor(4);
		}
		if (ColorPicker::iTab == 2)
		{
			ImGui::PushStyleColor(ImGuiCol_Button, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonActive, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonHovered, active);
			ImGui::PushStyleColor(ImGuiCol_Border, active);
			ImGui::SameLine();
			ImGui::SCP(buttonPos.x - 25.5f, buttonPos.y + 12);
			ImGui::Button("##Window3", ImVec2(5, 25));
			ImGui::PopStyleColor(4);
		}
		if (ColorPicker::iTab == 3)
		{
			ImGui::PushStyleColor(ImGuiCol_Button, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonActive, active);
			ImGui::PushStyleColor(ImGuiCol_ButtonHovered, active);
			ImGui::PushStyleColor(ImGuiCol_Border, active);
			ImGui::SameLine();
			ImGui::SCP(buttonPos.x - 25.5f, buttonPos.y + 12);
			ImGui::Button("##Window4", ImVec2(5, 25));
			ImGui::PopStyleColor(4);
		}
	}

	static void CustomContentWindow(const char* windowName, float windowSizeY, ImVec2 windowPos)
	{
		ImGui::SCP(windowPos.x, windowPos.y);
		ImGui::PushStyleColor(ImGuiCol_ChildBg, windowBgColor);
		ImGui::BeginChild(windowName, ImVec2(ImGui::GetX() - 10.f, windowSizeY));
		ImGui::EndChild();
		ImGui::PopStyleColor();
	}

	static void TaskbarCustomWindow(const char* windowName, const char* contentText, float windowSizeY, ImVec2 windowPos)
	{
		ImGui::SCP(windowPos.x, windowPos.y);
		ImGui::PushStyleColor(ImGuiCol_ChildBg, windowBgColor);
		ImGui::BeginChild(windowName, ImVec2(ImGui::GetX() - 10.f, windowSizeY));
		ImGui::SCPY(10.f);
		ImGui::CenterText(contentText, FALSE);
		ImGui::EndChild();
		ImGui::PopStyleColor();
	}

	static void TaskbarCustomWindow2(const char* windowName, const char* contentText, float windowSizeY, ImVec2 windowPos)
	{
		ImGui::SCP(windowPos.x, windowPos.y);
		ImGui::PushStyleColor(ImGuiCol_ChildBg, childBgColor);
		ImGui::BeginChild(windowName, ImVec2(ImGui::GetX() - 10.f, windowSizeY));
		ImGui::SCPY(10.f);
		ImGui::CenterText(contentText, FALSE);
		ImGui::EndChild();
		ImGui::PopStyleColor();
	}

	static void ToggleButton(const char* toggleName, bool* featureBool, ImVec2 pos, BOOL newLine)
	{
		ImGui::SCP(pos.x, pos.y);
		ImVec2 p = ImGui::GetCursorScreenPos();
		ImDrawList* draw_list = ImGui::GetWindowDrawList();
		int id = pos.y;

		float height = ImGui::GetFrameHeight();
		float width = height * 1.55f;
		float radius = height * 0.50f;

		ImGui::InvisibleButton(toggleName, ImVec2(width, height));
		if (ImGui::IsItemClicked())
			*featureBool = !*featureBool;

		float t = *featureBool ? 1.0f : 0.0f;

		ImGuiContext& g = *GImGui;
		float ANIM_SPEED = 0.08f;
		if (g.LastActiveId == g.CurrentWindow->GetID(toggleName))// && g.LastActiveIdTimer < ANIM_SPEED)
		{
			float t_anim = ImSaturate(g.LastActiveIdTimer / ANIM_SPEED);
			t = *featureBool ? (t_anim) : (1.0f - t_anim);
		}

		ImU32 col_bg;
		if (ImGui::IsItemHovered())
			col_bg = ImGui::GetColorU32(ImLerp(ImVec4(0.78f, 0.78f, 0.78f, 0.40f), ImVec4(ImColor(0, 68, 170, 200)), t));
		else
			col_bg = ImGui::GetColorU32(ImLerp(ImVec4(0.85f, 0.85f, 0.85f, 0.60f), ImVec4(ImColor(0, 68, 170, 255)), t));

		draw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), col_bg, height * 0.5f);
		draw_list->AddCircleFilled(ImVec2(p.x + radius + t * (width - radius * 2.0f), p.y + radius), radius - 1.5f, IM_COL32(225, 225, 225, 255));

		ImGui::SCP(10.f, pos.y);
		ImGui::Text(toggleName);
		ImGui::NewLine();
		ImGui::HoroizontalLine(id, ImVec2(ImGui::GetX() - 20.f, 5.f), ImVec2(10.f, pos.y + 35.f));

		if (newLine)
			ImGui::NewLine();
	}

	static void CustomSliderInt(const char* sliderText, int* value, int min, int max, ImVec4 color)
	{
		ImGui::PushStyleColor(ImGuiCol_FrameBg, color);
		ImGui::SliderInt(sliderText, value, min, max);
		ImGui::PopStyleColor();
		ImGui::NewLine();
	}

	static COLORREF GetPixelColor(POINT& pos)
	{
		// Get the device context for the entire screen
		// Passing NULL to GetDC gets the DC for the primary monitor.
		HDC hdcScreen = GetDC(NULL);

		if (hdcScreen == NULL)
		{
			// Failed to get screen DC
			return CLR_INVALID; // CLR_INVALID is a predefined value indicating an invalid color
		}

		// Get the pixel color at the specified coordinates
		COLORREF pixelColor = GetPixel(hdcScreen, pos.x, pos.y);

		// Release the screen device context
		ReleaseDC(NULL, hdcScreen);

		// Check if GetPixel failed (can happen if coordinates are outside the screen)
		if (pixelColor == CLR_INVALID)
		{
			// GetPixel failed
			return CLR_INVALID;
		}

		return pixelColor;
	}

	static bool GetMousePos(POINT& pos)
	{
		if (GetCursorPos(&pos))
			return true;
		else
			return false;
	}

	static void GetCurrentPixelColor()
	{
		if (GetAsyncKeyState(VK_LBUTTON) & 1 && ColorPicker::bEyeDropper && !ColorPicker::bEyeDropperHovered)
			ColorPicker::bEyeDropper = false;

		if (ColorPicker::bEyeDropper)
		{
			POINT currentMousePos;
			if (GetMousePos(currentMousePos))
			{
				COLORREF color = GetPixelColor(currentMousePos);

				if (color != CLR_INVALID)
				{
					BYTE red = GetRValue(color);
					BYTE green = GetGValue(color);
					BYTE blue = GetBValue(color);

					ImGui::iRValue = (int)red;
					ImGui::iGValue = (int)green;
					ImGui::iBValue = (int)blue;

					ImGui::newColorPicked = { (float)red / 255.0f, (float)green / 255.0f, (float)blue / 255.0f, 1.0f };
					ImGui::windowBgColor = { (float)ImGui::iRValue / 255.0f, (float)ImGui::iGValue / 255.0f, (float)ImGui::iBValue / 255.0f, 1.0f };
					ImGui::childBgColor = { (float)ImGui::iRValue / 255.0f, (float)ImGui::iGValue / 255.0f, (float)ImGui::iBValue / 255.0f, 1.0f };
					ImGui::textColor = { (float)ImGui::iRValue / 255.0f + 0.50f, (float)ImGui::iGValue / 255.0f + 0.50f, (float)ImGui::iBValue / 255.0f + 0.50f, 1.0f };
					ImGui::newIconColorActive = { (float)ImGui::iRValue / 255.0f + 0.50f, (float)ImGui::iGValue / 255.0f + 0.50f, (float)ImGui::iBValue / 255.0f + 0.50f, 1.0f };
					ImGui::newIconColorInactive = { (float)ImGui::iRValue / 255.0f - 0.10f, (float)ImGui::iGValue / 255.0f - 0.10f, (float)ImGui::iBValue / 255.0f - 0.10f, 1.0f };
					ImGui::sliderColor = { (float)ImGui::iRValue / 255.0f + 0.20f, (float)ImGui::iGValue / 255.0f + 0.20f, (float)ImGui::iBValue / 255.0f + 0.20f, 1.0f };
					ImGui::sliderScrollColor = { (float)ImGui::iRValue / 255.0f - 0.20f, (float)ImGui::iGValue / 255.0f - 0.20f, (float)ImGui::iBValue / 255.0f - 0.20f, 1.0f };

					if (ImGui::newColorPicked.x > 0.90f)
					{
						ImGui::textColor = { 0.20f, 0.20f, 0.20f, 1.0f };
						ImGui::newIconColorActive = { 0.20f, 0.20f, 0.20f, 1.0f };
						ImGui::newIconColorInactive = { 0.20f, 0.20f, 0.20f, 1.0f };
						ImGui::sliderColor = { 0.20f, 0.20f, 0.20f, 1.0f };
					}
					else if (ImGui::newColorPicked.x < 0.20f)
					{
						ImGui::textColor = { 0.90f, 0.90f, 0.90f, 1.0f };
						ImGui::newIconColorActive = { 0.90f, 0.90f, 0.90f, 1.0f };
						ImGui::newIconColorInactive = { 0.90f, 0.90f, 0.90f, 1.0f };
						ImGui::sliderColor = { 0.90f, 0.90f, 0.90f, 1.0f };
					}

					std::cout << "Color at (" << currentMousePos.x << ", " << currentMousePos.y << "):"
						<< " R=" << ImGui::iRValue
						<< ", G=" << ImGui::iGValue
						<< ", B=" << ImGui::iBValue << std::endl;
				}
				else
				{
					std::cerr << "Failed to get pixel color." << std::endl;
				}
			}
			else
			{
				std::cout << "Failed to get mouse position.\n\n";
			}
		}
	}
}

class MainLayer : public Desktop::Layer
{
public:
	virtual void OnAttach() override
	{
		ImGui::SetUITheme();
		ImGui::SetNextWindowSize(Desktop::Application::GetWindowSize(), ImGuiCond_Always);
	}

	virtual void OnUIRender() override
	{		
		// Main UI Window.
		//ImGui::PushStyleColor(ImGuiCol_WindowBg, ImGui::)
		if (ImGui::Begin("Color Picker ++", nullptr, ImGui::windowFlags))
		{
			// Top Side Status Bar Window.
			ImGui::SCP(10.f, 10.f);
			//ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.55f, 0.55f, 0.55f, 1.f));
			if (ImGui::BeginChild("TopSideStatusBarWindow", ImVec2(ImGui::GetX() - 10.f, 50.f), true, ImGui::windowFlags))
			{
				ImGui::SCPY(15.f);
				ImGui::PushStyleColor(ImGuiCol_Text, ImGui::textColor);
				ImGui::PushFont(ImGui::Body);
				ImGui::CenterText("Color Picker ++", FALSE);
				ImGui::PopFont();
				ImGui::PopStyleColor();
				ImGui::ButtonIcon(ICON_FA_COGS, &ColorPicker::iTab, 100, ImVec2(10.f, 7.f), ImVec2(35.f, 35.f)); // Config Page.
				ImGui::ButtonIcon2(ICON_FA_EYE_DROPPER, &ColorPicker::bEyeDropper, ImVec2(60.f, 7.f), ImVec2(35.f, 35.f));
			} ImGui::EndChild();

			// Main Child Window.
			ImGui::SCP(10.f, 70.f);
			if (ImGui::BeginChild("MainChildWindow", ImVec2(ImGui::GetX() - 10.f, ImGui::GetY() - 10.f), true, ImGui::windowFlags))
			{
				if (ColorPicker::iTab == 0)
				{
					ImGui::SCP(10.f, 10.f);
					if (ImGui::BeginChild("MainSubChildWindow", ImVec2(ImGui::GetX() - 10.f, ImGui::GetY() - 10.f), true, ImGui::windowFlags))
					{
						//ImGui::SliderInt("R", &ImGui::iRValue, 0, 255);
						//ImGui::SliderInt("G", &ImGui::iGValue, 0, 255);
						//ImGui::SliderInt("B", &ImGui::iBValue, 0, 255);
						ImGui::CustomSliderInt("R", &ImGui::iRValue, 0, 255, ImVec4(1.f, 0.f, 0.f, 0.40f));
						ImGui::CustomSliderInt("G", &ImGui::iGValue, 0, 255, ImVec4(0.f, 1.f, 0.f, 0.40f));
						ImGui::CustomSliderInt("B", &ImGui::iBValue, 0, 255, ImVec4(0.f, 0.f, 1.f, 0.40f));
					} ImGui::EndChild();
				}
			} ImGui::EndChild();
		} ImGui::End();
	}

	virtual void OnUpdate() override
	{
		ImGui::GetCurrentPixelColor();
	}
};