mocha.cpp
· 4.6 KiB · C++
Raw
void StyleCatppuccinMocha(ImGuiStyle* dst = NULL)
{
auto HexToImVec4 = [](const std::string& hex) {
unsigned rgba;
std::stringstream ss;
ss << std::hex << hex.substr(1);
ss >> rgba;
ImVec4 res = {
(float)((rgba >> 24) & 0xFF) / 255.0f,
(float)((rgba >> 16) & 0xFF) / 255.0f,
(float)((rgba >> 8) & 0xFF) / 255.0f,
(float)((rgba >> 0) & 0xFF) / 255.0f
};
return res;
};
ImGuiStyle* style = dst ? dst : &ImGui::GetStyle();
style->WindowPadding = ImVec2(15, 15);
style->WindowRounding = 5.0f;
style->FramePadding = ImVec2(5, 5);
style->FrameRounding = 4.0f;
style->ItemSpacing = ImVec2(12, 8);
style->ItemInnerSpacing = ImVec2(8, 6);
style->IndentSpacing = 25.0f;
style->ScrollbarSize = 15.0f;
style->ScrollbarRounding = 9.0f;
style->GrabMinSize = 5.0f;
style->GrabRounding = 3.0f;
style->Colors[ImGuiCol_Text] = HexToImVec4("#CDD6F4FF");
style->Colors[ImGuiCol_TextDisabled] = HexToImVec4("#7F849CFF");
style->Colors[ImGuiCol_WindowBg] = HexToImVec4("#1e1e2eff");
style->Colors[ImGuiCol_ChildBg] = HexToImVec4("#1e1e2eff");
style->Colors[ImGuiCol_PopupBg] = HexToImVec4("#1e1e2eff");
style->Colors[ImGuiCol_Border] = HexToImVec4("#A6ADC8FF");
style->Colors[ImGuiCol_BorderShadow] = HexToImVec4("#BAC2DEFF");
style->Colors[ImGuiCol_FrameBg] = HexToImVec4("#1e1e2eff");
style->Colors[ImGuiCol_FrameBgHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_FrameBgActive] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_TitleBg] = HexToImVec4("#181825FF");
style->Colors[ImGuiCol_TitleBgActive] = HexToImVec4("#181825FF");
style->Colors[ImGuiCol_TitleBgCollapsed] = HexToImVec4("#181825FF");
style->Colors[ImGuiCol_MenuBarBg] = HexToImVec4("#1e1e2eff");
style->Colors[ImGuiCol_ScrollbarBg] = HexToImVec4("#1e1e2eff");
style->Colors[ImGuiCol_ScrollbarGrab] = HexToImVec4("#7F849CFF");
style->Colors[ImGuiCol_ScrollbarGrabHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_ScrollbarGrabActive] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_CheckMark] = HexToImVec4("#89B4FAFF");
style->Colors[ImGuiCol_SliderGrab] = HexToImVec4("#6C7086FF");
style->Colors[ImGuiCol_SliderGrabActive] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_Button] = HexToImVec4("#89B4FA80");
style->Colors[ImGuiCol_ButtonHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_ButtonActive] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_Header] = HexToImVec4("#74C7EC80");
style->Colors[ImGuiCol_HeaderHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_HeaderActive] = HexToImVec4("#B4BEFE80");
style->Colors[ImGuiCol_Separator] = style->Colors[ImGuiCol_Border];
style->Colors[ImGuiCol_SeparatorHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_SeparatorActive] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_ResizeGrip] = HexToImVec4("#7F849CFF");
style->Colors[ImGuiCol_ResizeGripHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_ResizeGripActive] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_Tab] = HexToImVec4("#6C7086FF");
style->Colors[ImGuiCol_TabHovered] = HexToImVec4("#89DCEB80");
style->Colors[ImGuiCol_TabActive] = HexToImVec4("#B4BEFE80");
style->Colors[ImGuiCol_TabUnfocused] = HexToImVec4("#7F849C80");
style->Colors[ImGuiCol_TabUnfocusedActive] = HexToImVec4("#6C708680");
style->Colors[ImGuiCol_DockingPreview] = HexToImVec4("#89DCEBFF");
style->Colors[ImGuiCol_DockingEmptyBg] = HexToImVec4("#1E1E2EFF");
style->Colors[ImGuiCol_PlotLines] = HexToImVec4("#A6ADC8FF");
style->Colors[ImGuiCol_PlotLinesHovered] = HexToImVec4("#F5C2E780");
style->Colors[ImGuiCol_PlotHistogram] = HexToImVec4("#F9E2AFFF");
style->Colors[ImGuiCol_PlotHistogramHovered] = HexToImVec4("#FAB38780");
style->Colors[ImGuiCol_TableHeaderBg] = HexToImVec4("#6C7086FF");
style->Colors[ImGuiCol_TableBorderStrong] = HexToImVec4("#9399B2FF");
style->Colors[ImGuiCol_TableBorderLight] = HexToImVec4("#7F849CFF");
style->Colors[ImGuiCol_TableRowBg] = HexToImVec4("#181825FF");
style->Colors[ImGuiCol_TableRowBgAlt] = HexToImVec4("#11111BFF");
style->Colors[ImGuiCol_TextSelectedBg] = HexToImVec4("#585B7080");
style->Colors[ImGuiCol_DragDropTarget] = HexToImVec4("#74C7ECFF");
style->Colors[ImGuiCol_NavHighlight] = HexToImVec4("#B4BEFEFF");
style->Colors[ImGuiCol_NavWindowingHighlight] = HexToImVec4("#6C7086FF");
style->Colors[ImGuiCol_NavWindowingDimBg] = HexToImVec4("#CDD6F4FF");
style->Colors[ImGuiCol_ModalWindowDimBg] = HexToImVec4("#BAC2DE80");
}
| 1 | void StyleCatppuccinMocha(ImGuiStyle* dst = NULL) |
| 2 | { |
| 3 | auto HexToImVec4 = [](const std::string& hex) { |
| 4 | unsigned rgba; |
| 5 | std::stringstream ss; |
| 6 | ss << std::hex << hex.substr(1); |
| 7 | ss >> rgba; |
| 8 | ImVec4 res = { |
| 9 | (float)((rgba >> 24) & 0xFF) / 255.0f, |
| 10 | (float)((rgba >> 16) & 0xFF) / 255.0f, |
| 11 | (float)((rgba >> 8) & 0xFF) / 255.0f, |
| 12 | (float)((rgba >> 0) & 0xFF) / 255.0f |
| 13 | }; |
| 14 | return res; |
| 15 | }; |
| 16 | |
| 17 | ImGuiStyle* style = dst ? dst : &ImGui::GetStyle(); |
| 18 | |
| 19 | style->WindowPadding = ImVec2(15, 15); |
| 20 | style->WindowRounding = 5.0f; |
| 21 | style->FramePadding = ImVec2(5, 5); |
| 22 | style->FrameRounding = 4.0f; |
| 23 | style->ItemSpacing = ImVec2(12, 8); |
| 24 | style->ItemInnerSpacing = ImVec2(8, 6); |
| 25 | style->IndentSpacing = 25.0f; |
| 26 | style->ScrollbarSize = 15.0f; |
| 27 | style->ScrollbarRounding = 9.0f; |
| 28 | style->GrabMinSize = 5.0f; |
| 29 | style->GrabRounding = 3.0f; |
| 30 | |
| 31 | style->Colors[ImGuiCol_Text] = HexToImVec4("#CDD6F4FF"); |
| 32 | style->Colors[ImGuiCol_TextDisabled] = HexToImVec4("#7F849CFF"); |
| 33 | style->Colors[ImGuiCol_WindowBg] = HexToImVec4("#1e1e2eff"); |
| 34 | style->Colors[ImGuiCol_ChildBg] = HexToImVec4("#1e1e2eff"); |
| 35 | style->Colors[ImGuiCol_PopupBg] = HexToImVec4("#1e1e2eff"); |
| 36 | style->Colors[ImGuiCol_Border] = HexToImVec4("#A6ADC8FF"); |
| 37 | style->Colors[ImGuiCol_BorderShadow] = HexToImVec4("#BAC2DEFF"); |
| 38 | style->Colors[ImGuiCol_FrameBg] = HexToImVec4("#1e1e2eff"); |
| 39 | style->Colors[ImGuiCol_FrameBgHovered] = HexToImVec4("#89DCEB80"); |
| 40 | style->Colors[ImGuiCol_FrameBgActive] = HexToImVec4("#B4BEFEFF"); |
| 41 | style->Colors[ImGuiCol_TitleBg] = HexToImVec4("#181825FF"); |
| 42 | style->Colors[ImGuiCol_TitleBgActive] = HexToImVec4("#181825FF"); |
| 43 | style->Colors[ImGuiCol_TitleBgCollapsed] = HexToImVec4("#181825FF"); |
| 44 | style->Colors[ImGuiCol_MenuBarBg] = HexToImVec4("#1e1e2eff"); |
| 45 | style->Colors[ImGuiCol_ScrollbarBg] = HexToImVec4("#1e1e2eff"); |
| 46 | style->Colors[ImGuiCol_ScrollbarGrab] = HexToImVec4("#7F849CFF"); |
| 47 | style->Colors[ImGuiCol_ScrollbarGrabHovered] = HexToImVec4("#89DCEB80"); |
| 48 | style->Colors[ImGuiCol_ScrollbarGrabActive] = HexToImVec4("#B4BEFEFF"); |
| 49 | style->Colors[ImGuiCol_CheckMark] = HexToImVec4("#89B4FAFF"); |
| 50 | style->Colors[ImGuiCol_SliderGrab] = HexToImVec4("#6C7086FF"); |
| 51 | style->Colors[ImGuiCol_SliderGrabActive] = HexToImVec4("#B4BEFEFF"); |
| 52 | style->Colors[ImGuiCol_Button] = HexToImVec4("#89B4FA80"); |
| 53 | style->Colors[ImGuiCol_ButtonHovered] = HexToImVec4("#89DCEB80"); |
| 54 | style->Colors[ImGuiCol_ButtonActive] = HexToImVec4("#B4BEFEFF"); |
| 55 | style->Colors[ImGuiCol_Header] = HexToImVec4("#74C7EC80"); |
| 56 | style->Colors[ImGuiCol_HeaderHovered] = HexToImVec4("#89DCEB80"); |
| 57 | style->Colors[ImGuiCol_HeaderActive] = HexToImVec4("#B4BEFE80"); |
| 58 | style->Colors[ImGuiCol_Separator] = style->Colors[ImGuiCol_Border]; |
| 59 | style->Colors[ImGuiCol_SeparatorHovered] = HexToImVec4("#89DCEB80"); |
| 60 | style->Colors[ImGuiCol_SeparatorActive] = HexToImVec4("#B4BEFEFF"); |
| 61 | style->Colors[ImGuiCol_ResizeGrip] = HexToImVec4("#7F849CFF"); |
| 62 | style->Colors[ImGuiCol_ResizeGripHovered] = HexToImVec4("#89DCEB80"); |
| 63 | style->Colors[ImGuiCol_ResizeGripActive] = HexToImVec4("#B4BEFEFF"); |
| 64 | style->Colors[ImGuiCol_Tab] = HexToImVec4("#6C7086FF"); |
| 65 | style->Colors[ImGuiCol_TabHovered] = HexToImVec4("#89DCEB80"); |
| 66 | style->Colors[ImGuiCol_TabActive] = HexToImVec4("#B4BEFE80"); |
| 67 | style->Colors[ImGuiCol_TabUnfocused] = HexToImVec4("#7F849C80"); |
| 68 | style->Colors[ImGuiCol_TabUnfocusedActive] = HexToImVec4("#6C708680"); |
| 69 | style->Colors[ImGuiCol_DockingPreview] = HexToImVec4("#89DCEBFF"); |
| 70 | style->Colors[ImGuiCol_DockingEmptyBg] = HexToImVec4("#1E1E2EFF"); |
| 71 | style->Colors[ImGuiCol_PlotLines] = HexToImVec4("#A6ADC8FF"); |
| 72 | style->Colors[ImGuiCol_PlotLinesHovered] = HexToImVec4("#F5C2E780"); |
| 73 | style->Colors[ImGuiCol_PlotHistogram] = HexToImVec4("#F9E2AFFF"); |
| 74 | style->Colors[ImGuiCol_PlotHistogramHovered] = HexToImVec4("#FAB38780"); |
| 75 | style->Colors[ImGuiCol_TableHeaderBg] = HexToImVec4("#6C7086FF"); |
| 76 | style->Colors[ImGuiCol_TableBorderStrong] = HexToImVec4("#9399B2FF"); |
| 77 | style->Colors[ImGuiCol_TableBorderLight] = HexToImVec4("#7F849CFF"); |
| 78 | style->Colors[ImGuiCol_TableRowBg] = HexToImVec4("#181825FF"); |
| 79 | style->Colors[ImGuiCol_TableRowBgAlt] = HexToImVec4("#11111BFF"); |
| 80 | style->Colors[ImGuiCol_TextSelectedBg] = HexToImVec4("#585B7080"); |
| 81 | style->Colors[ImGuiCol_DragDropTarget] = HexToImVec4("#74C7ECFF"); |
| 82 | style->Colors[ImGuiCol_NavHighlight] = HexToImVec4("#B4BEFEFF"); |
| 83 | style->Colors[ImGuiCol_NavWindowingHighlight] = HexToImVec4("#6C7086FF"); |
| 84 | style->Colors[ImGuiCol_NavWindowingDimBg] = HexToImVec4("#CDD6F4FF"); |
| 85 | style->Colors[ImGuiCol_ModalWindowDimBg] = HexToImVec4("#BAC2DE80"); |
| 86 | } |
| 87 |