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] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);
99 colors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);
100 colors[ImGuiCol_SliderGrabActive] = ImVec4(0.36f, 0.45f, 0.36f, 0.60f);
102 colors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 0.60f);
103 colors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);
104 colors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);
105 colors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.10f);
106 colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);
107 colors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);
109 colors[ImGuiCol_TabUnfocused] =
110 ImLerp(colors[ImGuiCol_Tab], colors[ImGuiCol_TitleBg], 0.80f);
111 colors[ImGuiCol_TabUnfocusedActive] =
112 ImLerp(colors[ImGuiCol_TabActive], colors[ImGuiCol_TitleBg], 0.40f);
113 colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
114 colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
115 colors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);
116 colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);
117 colors[ImGuiCol_TableHeaderBg] = alttpDarkGreen;
118 colors[ImGuiCol_TableBorderStrong] = alttpMidGreen;
119 colors[ImGuiCol_TableBorderLight] =
120 ImVec4(0.26f, 0.26f, 0.28f, 1.00f);
121 colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
122 colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.07f);
123 colors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);
124 colors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);
125 colors[ImGuiCol_NavHighlight] = colors[ImGuiCol_HeaderHovered];
126 colors[ImGuiCol_NavWindowingHighlight] = ImVec4(1.00f, 1.00f, 1.00f, 0.70f);
127 colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
128 colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
364 ImGuiStyle &style = ImGui::GetStyle();
365 static ImGuiStyle ref_saved_style;
368 static bool init =
true;
369 if (init && ref == NULL) ref_saved_style = style;
371 if (ref == NULL) ref = &ref_saved_style;
373 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
376 if (ImGui::CollapsingHeader(
"Theme Management", ImGuiTreeNodeFlags_DefaultOpen)) {
378 static bool show_theme_selector =
false;
379 static bool show_theme_editor =
false;
384 std::string current_theme_name = theme_manager.GetCurrentThemeName();
385 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
388 if (is_classic_active) {
389 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s", current_theme_name.c_str());
391 ImGui::Text(
"%s", current_theme_name.c_str());
395 auto current_theme = theme_manager.GetCurrentTheme();
398 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
401 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
404 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
409 if (ImGui::BeginTable(
"ThemeSelectionTable", 3,
410 ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoHostExtendY,
413 ImGui::TableSetupColumn(
"Built-in", ImGuiTableColumnFlags_WidthStretch, 0.3f);
414 ImGui::TableSetupColumn(
"File Themes", ImGuiTableColumnFlags_WidthStretch, 0.4f);
415 ImGui::TableSetupColumn(
"Actions", ImGuiTableColumnFlags_WidthStretch, 0.3f);
416 ImGui::TableHeadersRow();
418 ImGui::TableNextRow();
421 ImGui::TableNextColumn();
422 if (is_classic_active) {
423 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
426 if (ImGui::Button(
"Classic YAZE", ImVec2(-1, 30))) {
427 theme_manager.ApplyClassicYazeTheme();
428 ref_saved_style = style;
431 if (is_classic_active) {
432 ImGui::PopStyleColor();
435 if (ImGui::Button(
"Reset ColorsYaze", ImVec2(-1, 30))) {
437 ref_saved_style = style;
441 ImGui::TableNextColumn();
442 auto available_themes = theme_manager.GetAvailableThemes();
443 const char* current_file_theme =
"";
446 for (
const auto& theme_name : available_themes) {
447 if (theme_name == current_theme_name) {
448 current_file_theme = theme_name.c_str();
453 ImGui::SetNextItemWidth(-1);
454 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
455 for (
const auto& theme_name : available_themes) {
456 bool is_selected = (theme_name == current_theme_name);
457 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
458 theme_manager.LoadTheme(theme_name);
459 ref_saved_style = style;
465 if (ImGui::Button(
"Refresh Themes", ImVec2(-1, 30))) {
466 theme_manager.RefreshAvailableThemes();
470 ImGui::TableNextColumn();
471 if (ImGui::Button(
"Theme Selector", ImVec2(-1, 30))) {
472 show_theme_selector =
true;
475 if (ImGui::Button(
"Theme Editor", ImVec2(-1, 30))) {
476 show_theme_editor =
true;
483 if (show_theme_selector) {
484 theme_manager.ShowThemeSelector(&show_theme_selector);
487 if (show_theme_editor) {
488 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
496 bg_renderer.DrawSettingsUI();
500 if (ImGui::ShowStyleSelector(
"Colors##Selector")) ref_saved_style = style;
501 ImGui::ShowFontSelector(
"Fonts##Selector");
505 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
507 style.GrabRounding = style.FrameRounding;
510 bool border = (style.WindowBorderSize > 0.0f);
511 if (ImGui::Checkbox(
"WindowBorder", &border)) {
512 style.WindowBorderSize = border ? 1.0f : 0.0f;
517 bool border = (style.FrameBorderSize > 0.0f);
518 if (ImGui::Checkbox(
"FrameBorder", &border)) {
519 style.FrameBorderSize = border ? 1.0f : 0.0f;
524 bool border = (style.PopupBorderSize > 0.0f);
525 if (ImGui::Checkbox(
"PopupBorder", &border)) {
526 style.PopupBorderSize = border ? 1.0f : 0.0f;
531 if (ImGui::Button(
"Save Ref")) *ref = ref_saved_style = style;
533 if (ImGui::Button(
"Revert Ref")) style = *ref;
538 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
539 if (ImGui::BeginTabItem(
"Sizes")) {
540 ImGui::SeparatorText(
"Main");
541 ImGui::SliderFloat2(
"WindowPadding", (
float *)&style.WindowPadding, 0.0f,
543 ImGui::SliderFloat2(
"FramePadding", (
float *)&style.FramePadding, 0.0f,
545 ImGui::SliderFloat2(
"ItemSpacing", (
float *)&style.ItemSpacing, 0.0f,
547 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float *)&style.ItemInnerSpacing,
548 0.0f, 20.0f,
"%.0f");
549 ImGui::SliderFloat2(
"TouchExtraPadding",
550 (
float *)&style.TouchExtraPadding, 0.0f, 10.0f,
552 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
554 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
556 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
559 ImGui::SeparatorText(
"Borders");
560 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
562 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
564 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
566 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
568 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
570 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
573 ImGui::SeparatorText(
"Rounding");
574 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
576 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
578 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
580 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
582 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
584 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
586 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
589 ImGui::SeparatorText(
"Tables");
590 ImGui::SliderFloat2(
"CellPadding", (
float *)&style.CellPadding, 0.0f,
592 ImGui::SliderAngle(
"TableAngledHeadersAngle",
593 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
595 ImGui::SeparatorText(
"Widgets");
596 ImGui::SliderFloat2(
"WindowTitleAlign", (
float *)&style.WindowTitleAlign,
598 ImGui::Combo(
"ColorButtonPosition", (
int *)&style.ColorButtonPosition,
600 ImGui::SliderFloat2(
"ButtonTextAlign", (
float *)&style.ButtonTextAlign,
604 ImGui::SliderFloat2(
"SelectableTextAlign",
605 (
float *)&style.SelectableTextAlign, 0.0f, 1.0f,
609 ImGui::SliderFloat(
"SeparatorTextBorderSize",
610 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
611 ImGui::SliderFloat2(
"SeparatorTextAlign",
612 (
float *)&style.SeparatorTextAlign, 0.0f, 1.0f,
614 ImGui::SliderFloat2(
"SeparatorTextPadding",
615 (
float *)&style.SeparatorTextPadding, 0.0f, 40.0f,
617 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
620 ImGui::SeparatorText(
"Tooltips");
621 for (
int n = 0; n < 2; n++)
622 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
623 :
"HoverFlagsForTooltipNav")) {
624 ImGuiHoveredFlags *p = (n == 0) ? &style.HoverFlagsForTooltipMouse
625 : &style.HoverFlagsForTooltipNav;
626 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
627 ImGuiHoveredFlags_DelayNone);
628 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
629 ImGuiHoveredFlags_DelayShort);
630 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
631 ImGuiHoveredFlags_DelayNormal);
632 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
633 ImGuiHoveredFlags_Stationary);
634 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
635 ImGuiHoveredFlags_NoSharedDelay);
639 ImGui::SeparatorText(
"Misc");
640 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
641 (
float *)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
648 if (ImGui::BeginTabItem(
"Colors")) {
649 static int output_dest = 0;
650 static bool output_only_modified =
true;
651 if (ImGui::Button(
"Export")) {
652 if (output_dest == 0)
653 ImGui::LogToClipboard();
656 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
657 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
658 const ImVec4 &col = style.Colors[i];
659 const char *name = ImGui::GetStyleColorName(i);
660 if (!output_only_modified ||
661 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
663 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
664 "%.2ff);" IM_NEWLINE,
665 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
670 ImGui::SetNextItemWidth(120);
671 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
673 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
675 static ImGuiTextFilter filter;
676 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
678 static ImGuiColorEditFlags alpha_flags = 0;
679 if (ImGui::RadioButton(
"Opaque",
680 alpha_flags == ImGuiColorEditFlags_None)) {
681 alpha_flags = ImGuiColorEditFlags_None;
684 if (ImGui::RadioButton(
"Alpha",
685 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
686 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
689 if (ImGui::RadioButton(
690 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
691 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
695 ImGui::SetNextWindowSizeConstraints(
696 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
697 ImVec2(FLT_MAX, FLT_MAX));
698 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
699 ImGuiWindowFlags_AlwaysVerticalScrollbar |
700 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
701 ImGuiWindowFlags_NavFlattened);
702 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
703 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
704 const char *name = ImGui::GetStyleColorName(i);
705 if (!filter.PassFilter(name))
continue;
707 ImGui::ColorEdit4(
"##color", (
float *)&style.Colors[i],
708 ImGuiColorEditFlags_AlphaBar | alpha_flags);
709 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
714 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
715 if (ImGui::Button(
"Save")) {
716 ref->Colors[i] = style.Colors[i];
718 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
719 if (ImGui::Button(
"Revert")) {
720 style.Colors[i] = ref->Colors[i];
723 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
724 ImGui::TextUnformatted(name);
727 ImGui::PopItemWidth();
733 if (ImGui::BeginTabItem(
"Fonts")) {
734 ImGuiIO &io = ImGui::GetIO();
735 ImFontAtlas *atlas = io.Fonts;
736 ImGui::ShowFontAtlas(atlas);
742 const float MIN_SCALE = 0.3f;
743 const float MAX_SCALE = 2.0f;
745 static float window_scale = 1.0f;
746 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
747 if (ImGui::DragFloat(
748 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
750 ImGuiSliderFlags_AlwaysClamp))
751 ImGui::SetWindowFontScale(window_scale);
752 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
754 ImGuiSliderFlags_AlwaysClamp);
755 ImGui::PopItemWidth();
760 if (ImGui::BeginTabItem(
"Rendering")) {
761 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
764 ImGui::Checkbox(
"Anti-aliased lines use texture",
765 &style.AntiAliasedLinesUseTex);
768 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
769 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
770 ImGui::DragFloat(
"Curve Tessellation Tolerance",
771 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
773 if (style.CurveTessellationTol < 0.10f)
774 style.CurveTessellationTol = 0.10f;
778 ImGui::DragFloat(
"Circle Tessellation Max Error",
779 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
780 "%.2f", ImGuiSliderFlags_AlwaysClamp);
781 const bool show_samples = ImGui::IsItemActive();
782 if (show_samples) ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
783 if (show_samples && ImGui::BeginTooltip()) {
784 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
786 ImDrawList *draw_list = ImGui::GetWindowDrawList();
787 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
788 for (
int n = 0; n < 8; n++) {
789 const float RAD_MIN = 5.0f;
790 const float RAD_MAX = 70.0f;
792 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
796 ImGui::Text(
"R: %.f\nN: %d", rad,
797 draw_list->_CalcCircleAutoSegmentCount(rad));
799 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
800 const float offset_x = floorf(canvas_width * 0.5f);
801 const float offset_y = floorf(RAD_MAX);
803 const ImVec2 p1 = ImGui::GetCursorScreenPos();
804 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
805 ImGui::GetColorU32(ImGuiCol_Text));
806 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
822 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
827 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
831 ImGui::PopItemWidth();
839 ImGui::PopItemWidth();
844 ImGuiStyle &style = ImGui::GetStyle();
845 static ImGuiStyle ref_saved_style;
848 static bool init =
true;
849 if (init && ref == NULL) ref_saved_style = style;
851 if (ref == NULL) ref = &ref_saved_style;
853 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
856 if (ImGui::CollapsingHeader(
"Theme Management", ImGuiTreeNodeFlags_DefaultOpen)) {
862 std::string current_theme_name = theme_manager.GetCurrentThemeName();
863 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
866 if (is_classic_active) {
867 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s", current_theme_name.c_str());
869 ImGui::Text(
"%s", current_theme_name.c_str());
873 auto current_theme = theme_manager.GetCurrentTheme();
876 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
879 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
882 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
887 if (is_classic_active) {
888 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
891 if (ImGui::Button(
"Classic YAZE")) {
892 theme_manager.ApplyClassicYazeTheme();
893 ref_saved_style = style;
896 if (is_classic_active) {
897 ImGui::PopStyleColor();
901 if (ImGui::Button(
"Reset ColorsYaze")) {
903 ref_saved_style = style;
907 auto available_themes = theme_manager.GetAvailableThemes();
908 const char* current_file_theme =
"";
911 for (
const auto& theme_name : available_themes) {
912 if (theme_name == current_theme_name) {
913 current_file_theme = theme_name.c_str();
918 ImGui::Text(
"File Themes:");
919 ImGui::SetNextItemWidth(-1);
920 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
921 for (
const auto& theme_name : available_themes) {
922 bool is_selected = (theme_name == current_theme_name);
923 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
924 theme_manager.LoadTheme(theme_name);
925 ref_saved_style = style;
931 if (ImGui::Button(
"Refresh Themes")) {
932 theme_manager.RefreshAvailableThemes();
935 if (ImGui::Button(
"Open Theme Editor")) {
936 static bool show_theme_editor =
true;
937 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
945 bg_renderer.DrawSettingsUI();
949 if (ImGui::ShowStyleSelector(
"Colors##Selector")) ref_saved_style = style;
950 ImGui::ShowFontSelector(
"Fonts##Selector");
953 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
"%.0f"))
954 style.GrabRounding = style.FrameRounding;
957 bool window_border = (style.WindowBorderSize > 0.0f);
958 if (ImGui::Checkbox(
"WindowBorder", &window_border)) {
959 style.WindowBorderSize = window_border ? 1.0f : 0.0f;
963 bool frame_border = (style.FrameBorderSize > 0.0f);
964 if (ImGui::Checkbox(
"FrameBorder", &frame_border)) {
965 style.FrameBorderSize = frame_border ? 1.0f : 0.0f;
969 bool popup_border = (style.PopupBorderSize > 0.0f);
970 if (ImGui::Checkbox(
"PopupBorder", &popup_border)) {
971 style.PopupBorderSize = popup_border ? 1.0f : 0.0f;
975 if (ImGui::Button(
"Save Ref")) *ref = ref_saved_style = style;
977 if (ImGui::Button(
"Revert Ref")) style = *ref;
982 if (ImGui::BeginTabBar(
"DisplaySettingsTabs", ImGuiTabBarFlags_None)) {
984 if (ImGui::BeginTabItem(
"Sizes")) {
985 ImGui::SeparatorText(
"Main");
986 ImGui::SliderFloat2(
"WindowPadding", (
float *)&style.WindowPadding, 0.0f,
988 ImGui::SliderFloat2(
"FramePadding", (
float *)&style.FramePadding, 0.0f,
990 ImGui::SliderFloat2(
"ItemSpacing", (
float *)&style.ItemSpacing, 0.0f,
992 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float *)&style.ItemInnerSpacing,
993 0.0f, 20.0f,
"%.0f");
994 ImGui::SliderFloat2(
"TouchExtraPadding",
995 (
float *)&style.TouchExtraPadding, 0.0f, 10.0f,
997 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
999 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
1001 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
1004 ImGui::SeparatorText(
"Borders");
1005 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
1007 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
1009 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
1011 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
1013 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
1015 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
1018 ImGui::SeparatorText(
"Rounding");
1019 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
1021 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
1023 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
1025 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
1027 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
1029 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
1031 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
1034 ImGui::SeparatorText(
"Tables");
1035 ImGui::SliderFloat2(
"CellPadding", (
float *)&style.CellPadding, 0.0f,
1037 ImGui::SliderAngle(
"TableAngledHeadersAngle",
1038 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
1040 ImGui::SeparatorText(
"Widgets");
1041 ImGui::SliderFloat2(
"WindowTitleAlign", (
float *)&style.WindowTitleAlign,
1042 0.0f, 1.0f,
"%.2f");
1043 ImGui::Combo(
"ColorButtonPosition", (
int *)&style.ColorButtonPosition,
1045 ImGui::SliderFloat2(
"ButtonTextAlign", (
float *)&style.ButtonTextAlign,
1046 0.0f, 1.0f,
"%.2f");
1049 ImGui::SliderFloat2(
"SelectableTextAlign",
1050 (
float *)&style.SelectableTextAlign, 0.0f, 1.0f,
1054 ImGui::SliderFloat(
"SeparatorTextBorderSize",
1055 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
1056 ImGui::SliderFloat2(
"SeparatorTextAlign",
1057 (
float *)&style.SeparatorTextAlign, 0.0f, 1.0f,
1059 ImGui::SliderFloat2(
"SeparatorTextPadding",
1060 (
float *)&style.SeparatorTextPadding, 0.0f, 40.0f,
1062 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
1065 ImGui::SeparatorText(
"Tooltips");
1066 for (
int n = 0; n < 2; n++)
1067 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
1068 :
"HoverFlagsForTooltipNav")) {
1069 ImGuiHoveredFlags *p = (n == 0) ? &style.HoverFlagsForTooltipMouse
1070 : &style.HoverFlagsForTooltipNav;
1071 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
1072 ImGuiHoveredFlags_DelayNone);
1073 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
1074 ImGuiHoveredFlags_DelayShort);
1075 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
1076 ImGuiHoveredFlags_DelayNormal);
1077 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
1078 ImGuiHoveredFlags_Stationary);
1079 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
1080 ImGuiHoveredFlags_NoSharedDelay);
1084 ImGui::SeparatorText(
"Misc");
1085 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
1086 (
float *)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
1090 ImGui::EndTabItem();
1093 if (ImGui::BeginTabItem(
"Colors")) {
1094 static int output_dest = 0;
1095 static bool output_only_modified =
true;
1096 if (ImGui::Button(
"Export")) {
1097 if (output_dest == 0)
1098 ImGui::LogToClipboard();
1101 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
1102 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1103 const ImVec4 &col = style.Colors[i];
1104 const char *name = ImGui::GetStyleColorName(i);
1105 if (!output_only_modified ||
1106 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
1108 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
1109 "%.2ff);" IM_NEWLINE,
1110 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
1115 ImGui::SetNextItemWidth(120);
1116 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
1118 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
1120 static ImGuiTextFilter filter;
1121 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
1123 static ImGuiColorEditFlags alpha_flags = 0;
1124 if (ImGui::RadioButton(
"Opaque",
1125 alpha_flags == ImGuiColorEditFlags_None)) {
1126 alpha_flags = ImGuiColorEditFlags_None;
1129 if (ImGui::RadioButton(
"Alpha",
1130 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
1131 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
1134 if (ImGui::RadioButton(
1135 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
1136 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
1140 ImGui::SetNextWindowSizeConstraints(
1141 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
1142 ImVec2(FLT_MAX, FLT_MAX));
1143 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
1144 ImGuiWindowFlags_AlwaysVerticalScrollbar |
1145 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
1146 ImGuiWindowFlags_NavFlattened);
1147 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
1148 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1149 const char *name = ImGui::GetStyleColorName(i);
1150 if (!filter.PassFilter(name))
continue;
1152 ImGui::ColorEdit4(
"##color", (
float *)&style.Colors[i],
1153 ImGuiColorEditFlags_AlphaBar | alpha_flags);
1154 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
1159 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1160 if (ImGui::Button(
"Save")) {
1161 ref->Colors[i] = style.Colors[i];
1163 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1164 if (ImGui::Button(
"Revert")) {
1165 style.Colors[i] = ref->Colors[i];
1168 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1169 ImGui::TextUnformatted(name);
1172 ImGui::PopItemWidth();
1175 ImGui::EndTabItem();
1178 if (ImGui::BeginTabItem(
"Fonts")) {
1179 ImGuiIO &io = ImGui::GetIO();
1180 ImFontAtlas *atlas = io.Fonts;
1181 ImGui::ShowFontAtlas(atlas);
1187 const float MIN_SCALE = 0.3f;
1188 const float MAX_SCALE = 2.0f;
1190 static float window_scale = 1.0f;
1191 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1192 if (ImGui::DragFloat(
1193 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
1195 ImGuiSliderFlags_AlwaysClamp))
1196 ImGui::SetWindowFontScale(window_scale);
1197 ImGui::DragFloat(
"global scale", &io.FontGlobalScale, 0.005f, MIN_SCALE,
1199 ImGuiSliderFlags_AlwaysClamp);
1200 ImGui::PopItemWidth();
1202 ImGui::EndTabItem();
1205 if (ImGui::BeginTabItem(
"Rendering")) {
1206 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
1209 ImGui::Checkbox(
"Anti-aliased lines use texture",
1210 &style.AntiAliasedLinesUseTex);
1213 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
1214 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1215 ImGui::DragFloat(
"Curve Tessellation Tolerance",
1216 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
1218 if (style.CurveTessellationTol < 0.10f)
1219 style.CurveTessellationTol = 0.10f;
1223 ImGui::DragFloat(
"Circle Tessellation Max Error",
1224 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
1225 "%.2f", ImGuiSliderFlags_AlwaysClamp);
1226 const bool show_samples = ImGui::IsItemActive();
1227 if (show_samples) ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
1228 if (show_samples && ImGui::BeginTooltip()) {
1229 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
1231 ImDrawList *draw_list = ImGui::GetWindowDrawList();
1232 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
1233 for (
int n = 0; n < 8; n++) {
1234 const float RAD_MIN = 5.0f;
1235 const float RAD_MAX = 70.0f;
1237 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
1239 ImGui::BeginGroup();
1241 ImGui::Text(
"R: %.f\nN: %d", rad,
1242 draw_list->_CalcCircleAutoSegmentCount(rad));
1244 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
1245 const float offset_x = floorf(canvas_width * 0.5f);
1246 const float offset_y = floorf(RAD_MAX);
1248 const ImVec2 p1 = ImGui::GetCursorScreenPos();
1249 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
1250 ImGui::GetColorU32(ImGuiCol_Text));
1251 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
1256 ImGui::EndTooltip();
1260 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
1265 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
1269 ImGui::PopItemWidth();
1271 ImGui::EndTabItem();
1277 ImGui::PopItemWidth();