33 ImGuiStyle* style = &ImGui::GetStyle();
34 ImVec4* colors = style->Colors;
36 style->WindowPadding = ImVec2(10.f, 10.f);
37 style->FramePadding = ImVec2(10.f, 2.f);
38 style->CellPadding = ImVec2(4.f, 5.f);
39 style->ItemSpacing = ImVec2(10.f, 5.f);
40 style->ItemInnerSpacing = ImVec2(5.f, 5.f);
41 style->TouchExtraPadding = ImVec2(0.f, 0.f);
42 style->IndentSpacing = 20.f;
43 style->ScrollbarSize = 14.f;
44 style->GrabMinSize = 15.f;
46 style->WindowBorderSize = 0.f;
47 style->ChildBorderSize = 1.f;
48 style->PopupBorderSize = 1.f;
49 style->FrameBorderSize = 0.f;
50 style->TabBorderSize = 0.f;
52 style->WindowRounding = 0.f;
53 style->ChildRounding = 0.f;
54 style->FrameRounding = 5.f;
55 style->PopupRounding = 0.f;
56 style->ScrollbarRounding = 5.f;
58 auto alttpDarkGreen = ImVec4(0.18f, 0.26f, 0.18f, 1.0f);
59 auto alttpMidGreen = ImVec4(0.28f, 0.36f, 0.28f, 1.0f);
60 auto allttpLightGreen = ImVec4(0.36f, 0.45f, 0.36f, 1.0f);
61 auto allttpLightestGreen = ImVec4(0.49f, 0.57f, 0.49f, 1.0f);
63 colors[ImGuiCol_MenuBarBg] = alttpDarkGreen;
64 colors[ImGuiCol_TitleBg] = alttpMidGreen;
66 colors[ImGuiCol_Header] = alttpDarkGreen;
67 colors[ImGuiCol_HeaderHovered] = allttpLightGreen;
68 colors[ImGuiCol_HeaderActive] = alttpMidGreen;
70 colors[ImGuiCol_TitleBgActive] = alttpDarkGreen;
71 colors[ImGuiCol_TitleBgCollapsed] = alttpMidGreen;
73 colors[ImGuiCol_Tab] = alttpDarkGreen;
74 colors[ImGuiCol_TabHovered] = alttpMidGreen;
75 colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
77 colors[ImGuiCol_Button] = alttpMidGreen;
78 colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
79 colors[ImGuiCol_ButtonActive] = allttpLightGreen;
81 colors[ImGuiCol_ScrollbarBg] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
82 colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.36f, 0.45f, 0.36f, 0.30f);
83 colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.36f, 0.45f, 0.36f, 0.40f);
84 colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
86 colors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);
87 colors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
88 colors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.85f);
89 colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
90 colors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);
91 colors[ImGuiCol_Border] = allttpLightGreen;
92 colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
94 colors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);
95 colors[ImGuiCol_FrameBgHovered] = ImVec4(0.28f, 0.36f, 0.28f, 0.40f);
96 colors[ImGuiCol_FrameBgActive] = ImVec4(0.28f, 0.36f, 0.28f, 0.69f);
98 colors[ImGuiCol_CheckMark] =
99 ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
100 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
101 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
103 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
104 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
105 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
106 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
107 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
108 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
110 colors[ImGuiCol_TabUnfocused] =
111 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
112 colors[ImGuiCol_TabUnfocusedActive] =
113 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
114 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
115 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
116 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
117 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
118 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
119 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
120 colors[ImGuiCol_TableBorderLight] =
121 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
122 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
123 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
124 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
125 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
126 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
127 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
128 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
129 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
376 ImGuiStyle& style = ImGui::GetStyle();
377 static ImGuiStyle ref_saved_style;
380 static bool init =
true;
381 if (init && ref == NULL)
382 ref_saved_style = style;
385 ref = &ref_saved_style;
387 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
390 if (ImGui::CollapsingHeader(
"Theme Management",
391 ImGuiTreeNodeFlags_DefaultOpen)) {
393 static bool show_theme_selector =
false;
394 static bool show_theme_editor =
false;
399 std::string current_theme_name = theme_manager.GetCurrentThemeName();
400 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
403 if (is_classic_active) {
404 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
405 current_theme_name.c_str());
407 ImGui::Text(
"%s", current_theme_name.c_str());
411 auto current_theme = theme_manager.GetCurrentTheme();
413 ImGui::ColorButton(
"##primary_preview",
415 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
417 ImGui::ColorButton(
"##secondary_preview",
419 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
421 ImGui::ColorButton(
"##accent_preview",
423 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
428 if (ImGui::BeginTable(
429 "ThemeSelectionTable", 3,
430 ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoHostExtendY,
432 ImGui::TableSetupColumn(
"Built-in", ImGuiTableColumnFlags_WidthStretch,
434 ImGui::TableSetupColumn(
"File Themes", ImGuiTableColumnFlags_WidthStretch,
436 ImGui::TableSetupColumn(
"Actions", ImGuiTableColumnFlags_WidthStretch,
438 ImGui::TableHeadersRow();
440 ImGui::TableNextRow();
443 ImGui::TableNextColumn();
444 if (is_classic_active) {
445 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
448 if (ImGui::Button(
"Classic YAZE", ImVec2(-1, 30))) {
449 theme_manager.ApplyClassicYazeTheme();
450 ref_saved_style = style;
453 if (is_classic_active) {
454 ImGui::PopStyleColor();
457 if (ImGui::Button(
"Reset ColorsYaze", ImVec2(-1, 30))) {
459 ref_saved_style = style;
463 ImGui::TableNextColumn();
464 auto available_themes = theme_manager.GetAvailableThemes();
465 const char* current_file_theme =
"";
468 for (
const auto& theme_name : available_themes) {
469 if (theme_name == current_theme_name) {
470 current_file_theme = theme_name.c_str();
475 ImGui::SetNextItemWidth(-1);
476 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
477 for (
const auto& theme_name : available_themes) {
478 bool is_selected = (theme_name == current_theme_name);
479 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
480 theme_manager.LoadTheme(theme_name);
481 ref_saved_style = style;
487 if (ImGui::Button(
"Refresh Themes", ImVec2(-1, 30))) {
488 theme_manager.RefreshAvailableThemes();
492 ImGui::TableNextColumn();
493 if (ImGui::Button(
"Theme Selector", ImVec2(-1, 30))) {
494 show_theme_selector =
true;
497 if (ImGui::Button(
"Theme Editor", ImVec2(-1, 30))) {
498 show_theme_editor =
true;
505 if (show_theme_selector) {
506 theme_manager.ShowThemeSelector(&show_theme_selector);
509 if (show_theme_editor) {
510 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
518 bg_renderer.DrawSettingsUI();
522 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
523 ref_saved_style = style;
524 ImGui::ShowFontSelector(
"Fonts##Selector");
528 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
530 style.GrabRounding = style.FrameRounding;
533 bool border = (style.WindowBorderSize > 0.0f);
534 if (ImGui::Checkbox(
"WindowBorder", &border)) {
535 style.WindowBorderSize = border ? 1.0f : 0.0f;
540 bool border = (style.FrameBorderSize > 0.0f);
541 if (ImGui::Checkbox(
"FrameBorder", &border)) {
542 style.FrameBorderSize = border ? 1.0f : 0.0f;
547 bool border = (style.PopupBorderSize > 0.0f);
548 if (ImGui::Checkbox(
"PopupBorder", &border)) {
549 style.PopupBorderSize = border ? 1.0f : 0.0f;
554 if (ImGui::Button(
"Save Ref"))
555 *ref = ref_saved_style = style;
557 if (ImGui::Button(
"Revert Ref"))
563 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
564 if (ImGui::BeginTabItem(
"Sizes")) {
565 ImGui::SeparatorText(
"Main");
566 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
568 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
570 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
572 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
573 0.0f, 20.0f,
"%.0f");
574 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
575 0.0f, 10.0f,
"%.0f");
576 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
578 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
580 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
583 ImGui::SeparatorText(
"Borders");
584 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
586 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
588 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
590 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
592 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
594 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
597 ImGui::SeparatorText(
"Rounding");
598 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
600 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
602 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
604 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
606 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
608 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
610 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
613 ImGui::SeparatorText(
"Tables");
614 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
616 ImGui::SliderAngle(
"TableAngledHeadersAngle",
617 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
619 ImGui::SeparatorText(
"Widgets");
620 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
622 ImGui::Combo(
"ColorButtonPosition", (
int*)&style.ColorButtonPosition,
624 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
628 ImGui::SliderFloat2(
"SelectableTextAlign",
629 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
633 ImGui::SliderFloat(
"SeparatorTextBorderSize",
634 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
635 ImGui::SliderFloat2(
"SeparatorTextAlign",
636 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
638 ImGui::SliderFloat2(
"SeparatorTextPadding",
639 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
641 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
644 ImGui::SeparatorText(
"Tooltips");
645 for (
int n = 0; n < 2; n++)
646 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
647 :
"HoverFlagsForTooltipNav")) {
648 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
649 : &style.HoverFlagsForTooltipNav;
650 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
651 ImGuiHoveredFlags_DelayNone);
652 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
653 ImGuiHoveredFlags_DelayShort);
654 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
655 ImGuiHoveredFlags_DelayNormal);
656 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
657 ImGuiHoveredFlags_Stationary);
658 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
659 ImGuiHoveredFlags_NoSharedDelay);
663 ImGui::SeparatorText(
"Misc");
664 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
665 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
672 if (ImGui::BeginTabItem(
"Colors")) {
673 static int output_dest = 0;
674 static bool output_only_modified =
true;
675 if (ImGui::Button(
"Export")) {
676 if (output_dest == 0)
677 ImGui::LogToClipboard();
680 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
681 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
682 const ImVec4& col = style.Colors[i];
683 const char* name = ImGui::GetStyleColorName(i);
684 if (!output_only_modified ||
685 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
687 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
688 "%.2ff);" IM_NEWLINE,
689 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
694 ImGui::SetNextItemWidth(120);
695 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
697 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
699 static ImGuiTextFilter filter;
700 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
702 static ImGuiColorEditFlags alpha_flags = 0;
703 if (ImGui::RadioButton(
"Opaque",
704 alpha_flags == ImGuiColorEditFlags_None)) {
705 alpha_flags = ImGuiColorEditFlags_None;
708 if (ImGui::RadioButton(
"Alpha",
709 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
710 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
713 if (ImGui::RadioButton(
714 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
715 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
719 ImGui::SetNextWindowSizeConstraints(
720 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
721 ImVec2(FLT_MAX, FLT_MAX));
722 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
723 ImGuiWindowFlags_AlwaysVerticalScrollbar |
724 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
725 ImGuiWindowFlags_NavFlattened);
726 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
727 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
728 const char* name = ImGui::GetStyleColorName(i);
729 if (!filter.PassFilter(name))
732 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
733 ImGuiColorEditFlags_AlphaBar | alpha_flags);
734 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
739 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
740 if (ImGui::Button(
"Save")) {
741 ref->Colors[i] = style.Colors[i];
743 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
744 if (ImGui::Button(
"Revert")) {
745 style.Colors[i] = ref->Colors[i];
748 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
749 ImGui::TextUnformatted(name);
752 ImGui::PopItemWidth();
758 if (ImGui::BeginTabItem(
"Fonts")) {
759 ImGuiIO& io = ImGui::GetIO();
760 ImFontAtlas* atlas = io.Fonts;
761 ImGui::ShowFontAtlas(atlas);
767 const float MIN_SCALE = 0.3f;
768 const float MAX_SCALE = 2.0f;
770 static float window_scale = 1.0f;
771 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
772 if (ImGui::DragFloat(
773 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
775 ImGuiSliderFlags_AlwaysClamp))
776 ImGui::SetWindowFontScale(window_scale);
777 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
779 ImGuiSliderFlags_AlwaysClamp);
780 ImGui::PopItemWidth();
785 if (ImGui::BeginTabItem(
"Rendering")) {
786 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
789 ImGui::Checkbox(
"Anti-aliased lines use texture",
790 &style.AntiAliasedLinesUseTex);
793 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
794 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
795 ImGui::DragFloat(
"Curve Tessellation Tolerance",
796 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
798 if (style.CurveTessellationTol < 0.10f)
799 style.CurveTessellationTol = 0.10f;
803 ImGui::DragFloat(
"Circle Tessellation Max Error",
804 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
805 "%.2f", ImGuiSliderFlags_AlwaysClamp);
806 const bool show_samples = ImGui::IsItemActive();
808 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
809 if (show_samples && ImGui::BeginTooltip()) {
810 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
812 ImDrawList* draw_list = ImGui::GetWindowDrawList();
813 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
814 for (
int n = 0; n < 8; n++) {
815 const float RAD_MIN = 5.0f;
816 const float RAD_MAX = 70.0f;
818 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
822 ImGui::Text(
"R: %.f\nN: %d", rad,
823 draw_list->_CalcCircleAutoSegmentCount(rad));
825 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
826 const float offset_x = floorf(canvas_width * 0.5f);
827 const float offset_y = floorf(RAD_MAX);
829 const ImVec2 p1 = ImGui::GetCursorScreenPos();
830 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
831 ImGui::GetColorU32(ImGuiCol_Text));
832 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
848 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
853 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
857 ImGui::PopItemWidth();
865 ImGui::PopItemWidth();
870 ImGuiStyle& style = ImGui::GetStyle();
871 static ImGuiStyle ref_saved_style;
874 static bool init =
true;
875 if (init && ref == NULL)
876 ref_saved_style = style;
879 ref = &ref_saved_style;
881 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
884 if (ImGui::CollapsingHeader(
"Theme Management",
885 ImGuiTreeNodeFlags_DefaultOpen)) {
891 std::string current_theme_name = theme_manager.GetCurrentThemeName();
892 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
895 if (is_classic_active) {
896 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
897 current_theme_name.c_str());
899 ImGui::Text(
"%s", current_theme_name.c_str());
903 auto current_theme = theme_manager.GetCurrentTheme();
905 ImGui::ColorButton(
"##primary_preview",
907 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
909 ImGui::ColorButton(
"##secondary_preview",
911 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
913 ImGui::ColorButton(
"##accent_preview",
915 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
920 if (is_classic_active) {
921 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
924 if (ImGui::Button(
"Classic YAZE")) {
925 theme_manager.ApplyClassicYazeTheme();
926 ref_saved_style = style;
929 if (is_classic_active) {
930 ImGui::PopStyleColor();
934 if (ImGui::Button(
"Reset ColorsYaze")) {
936 ref_saved_style = style;
940 auto available_themes = theme_manager.GetAvailableThemes();
941 const char* current_file_theme =
"";
944 for (
const auto& theme_name : available_themes) {
945 if (theme_name == current_theme_name) {
946 current_file_theme = theme_name.c_str();
951 ImGui::Text(
"File Themes:");
952 ImGui::SetNextItemWidth(-1);
953 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
954 for (
const auto& theme_name : available_themes) {
955 bool is_selected = (theme_name == current_theme_name);
956 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
957 theme_manager.LoadTheme(theme_name);
958 ref_saved_style = style;
964 if (ImGui::Button(
"Refresh Themes")) {
965 theme_manager.RefreshAvailableThemes();
968 if (ImGui::Button(
"Open Theme Editor")) {
969 static bool show_theme_editor =
true;
970 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
978 bg_renderer.DrawSettingsUI();
982 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
983 ref_saved_style = style;
984 ImGui::ShowFontSelector(
"Fonts##Selector");
987 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
989 style.GrabRounding = style.FrameRounding;
992 bool window_border = (style.WindowBorderSize > 0.0f);
993 if (ImGui::Checkbox(
"WindowBorder", &window_border)) {
994 style.WindowBorderSize = window_border ? 1.0f : 0.0f;
998 bool frame_border = (style.FrameBorderSize > 0.0f);
999 if (ImGui::Checkbox(
"FrameBorder", &frame_border)) {
1000 style.FrameBorderSize = frame_border ? 1.0f : 0.0f;
1004 bool popup_border = (style.PopupBorderSize > 0.0f);
1005 if (ImGui::Checkbox(
"PopupBorder", &popup_border)) {
1006 style.PopupBorderSize = popup_border ? 1.0f : 0.0f;
1010 if (ImGui::Button(
"Save Ref"))
1011 *ref = ref_saved_style = style;
1013 if (ImGui::Button(
"Revert Ref"))
1019 if (ImGui::BeginTabBar(
"DisplaySettingsTabs", ImGuiTabBarFlags_None)) {
1020 if (ImGui::BeginTabItem(
"Sizes")) {
1021 ImGui::SeparatorText(
"Main");
1022 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
1024 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
1026 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
1028 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
1029 0.0f, 20.0f,
"%.0f");
1030 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
1031 0.0f, 10.0f,
"%.0f");
1032 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
1034 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
1036 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
1039 ImGui::SeparatorText(
"Borders");
1040 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
1042 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
1044 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
1046 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
1048 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
1050 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
1053 ImGui::SeparatorText(
"Rounding");
1054 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
1056 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
1058 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
1060 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
1062 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
1064 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
1066 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
1069 ImGui::SeparatorText(
"Tables");
1070 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
1072 ImGui::SliderAngle(
"TableAngledHeadersAngle",
1073 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
1075 ImGui::SeparatorText(
"Widgets");
1076 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
1077 0.0f, 1.0f,
"%.2f");
1078 ImGui::Combo(
"ColorButtonPosition", (
int*)&style.ColorButtonPosition,
1080 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
1081 0.0f, 1.0f,
"%.2f");
1084 ImGui::SliderFloat2(
"SelectableTextAlign",
1085 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
1089 ImGui::SliderFloat(
"SeparatorTextBorderSize",
1090 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
1091 ImGui::SliderFloat2(
"SeparatorTextAlign",
1092 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
1094 ImGui::SliderFloat2(
"SeparatorTextPadding",
1095 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
1097 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
1100 ImGui::SeparatorText(
"Tooltips");
1101 for (
int n = 0; n < 2; n++)
1102 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
1103 :
"HoverFlagsForTooltipNav")) {
1104 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
1105 : &style.HoverFlagsForTooltipNav;
1106 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
1107 ImGuiHoveredFlags_DelayNone);
1108 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
1109 ImGuiHoveredFlags_DelayShort);
1110 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
1111 ImGuiHoveredFlags_DelayNormal);
1112 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
1113 ImGuiHoveredFlags_Stationary);
1114 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
1115 ImGuiHoveredFlags_NoSharedDelay);
1119 ImGui::SeparatorText(
"Misc");
1120 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
1121 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
1125 ImGui::EndTabItem();
1128 if (ImGui::BeginTabItem(
"Colors")) {
1129 static int output_dest = 0;
1130 static bool output_only_modified =
true;
1131 if (ImGui::Button(
"Export")) {
1132 if (output_dest == 0)
1133 ImGui::LogToClipboard();
1136 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
1137 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1138 const ImVec4& col = style.Colors[i];
1139 const char* name = ImGui::GetStyleColorName(i);
1140 if (!output_only_modified ||
1141 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
1143 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
1144 "%.2ff);" IM_NEWLINE,
1145 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
1150 ImGui::SetNextItemWidth(120);
1151 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
1153 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
1155 static ImGuiTextFilter filter;
1156 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
1158 static ImGuiColorEditFlags alpha_flags = 0;
1159 if (ImGui::RadioButton(
"Opaque",
1160 alpha_flags == ImGuiColorEditFlags_None)) {
1161 alpha_flags = ImGuiColorEditFlags_None;
1164 if (ImGui::RadioButton(
"Alpha",
1165 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
1166 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
1169 if (ImGui::RadioButton(
1170 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
1171 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
1175 ImGui::SetNextWindowSizeConstraints(
1176 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
1177 ImVec2(FLT_MAX, FLT_MAX));
1178 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
1179 ImGuiWindowFlags_AlwaysVerticalScrollbar |
1180 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
1181 ImGuiWindowFlags_NavFlattened);
1182 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
1183 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1184 const char* name = ImGui::GetStyleColorName(i);
1185 if (!filter.PassFilter(name))
1188 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
1189 ImGuiColorEditFlags_AlphaBar | alpha_flags);
1190 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
1195 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1196 if (ImGui::Button(
"Save")) {
1197 ref->Colors[i] = style.Colors[i];
1199 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1200 if (ImGui::Button(
"Revert")) {
1201 style.Colors[i] = ref->Colors[i];
1204 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1205 ImGui::TextUnformatted(name);
1208 ImGui::PopItemWidth();
1211 ImGui::EndTabItem();
1214 if (ImGui::BeginTabItem(
"Fonts")) {
1215 ImGuiIO& io = ImGui::GetIO();
1216 ImFontAtlas* atlas = io.Fonts;
1217 ImGui::ShowFontAtlas(atlas);
1223 const float MIN_SCALE = 0.3f;
1224 const float MAX_SCALE = 2.0f;
1226 static float window_scale = 1.0f;
1227 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1228 if (ImGui::DragFloat(
1229 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
1231 ImGuiSliderFlags_AlwaysClamp))
1232 ImGui::SetWindowFontScale(window_scale);
1233 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
1235 ImGuiSliderFlags_AlwaysClamp);
1236 ImGui::PopItemWidth();
1238 ImGui::EndTabItem();
1241 if (ImGui::BeginTabItem(
"Rendering")) {
1242 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
1245 ImGui::Checkbox(
"Anti-aliased lines use texture",
1246 &style.AntiAliasedLinesUseTex);
1249 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
1250 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1251 ImGui::DragFloat(
"Curve Tessellation Tolerance",
1252 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
1254 if (style.CurveTessellationTol < 0.10f)
1255 style.CurveTessellationTol = 0.10f;
1259 ImGui::DragFloat(
"Circle Tessellation Max Error",
1260 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
1261 "%.2f", ImGuiSliderFlags_AlwaysClamp);
1262 const bool show_samples = ImGui::IsItemActive();
1264 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
1265 if (show_samples && ImGui::BeginTooltip()) {
1266 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
1268 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1269 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
1270 for (
int n = 0; n < 8; n++) {
1271 const float RAD_MIN = 5.0f;
1272 const float RAD_MAX = 70.0f;
1274 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
1276 ImGui::BeginGroup();
1278 ImGui::Text(
"R: %.f\nN: %d", rad,
1279 draw_list->_CalcCircleAutoSegmentCount(rad));
1281 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
1282 const float offset_x = floorf(canvas_width * 0.5f);
1283 const float offset_y = floorf(RAD_MAX);
1285 const ImVec2 p1 = ImGui::GetCursorScreenPos();
1286 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
1287 ImGui::GetColorU32(ImGuiCol_Text));
1288 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
1293 ImGui::EndTooltip();
1297 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
1302 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
1306 ImGui::PopItemWidth();
1308 ImGui::EndTabItem();
1314 ImGui::PopItemWidth();