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);
381 ImGuiStyle& style = ImGui::GetStyle();
382 static ImGuiStyle ref_saved_style;
385 static bool init =
true;
386 if (init && ref == NULL)
387 ref_saved_style = style;
390 ref = &ref_saved_style;
392 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
395 if (ImGui::CollapsingHeader(
"Theme Management",
396 ImGuiTreeNodeFlags_DefaultOpen)) {
398 static bool show_theme_selector =
false;
399 static bool show_theme_editor =
false;
404 std::string current_theme_name = theme_manager.GetCurrentThemeName();
405 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
408 if (is_classic_active) {
409 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
410 current_theme_name.c_str());
412 ImGui::Text(
"%s", current_theme_name.c_str());
416 auto current_theme = theme_manager.GetCurrentTheme();
418 ImGui::ColorButton(
"##primary_preview",
420 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
422 ImGui::ColorButton(
"##secondary_preview",
424 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
426 ImGui::ColorButton(
"##accent_preview",
428 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
433 if (ImGui::BeginTable(
434 "ThemeSelectionTable", 3,
435 ImGuiTableFlags_SizingStretchProp | ImGuiTableFlags_NoHostExtendY,
437 ImGui::TableSetupColumn(
"Built-in", ImGuiTableColumnFlags_WidthStretch,
439 ImGui::TableSetupColumn(
"File Themes", ImGuiTableColumnFlags_WidthStretch,
441 ImGui::TableSetupColumn(
"Actions", ImGuiTableColumnFlags_WidthStretch,
443 ImGui::TableHeadersRow();
445 ImGui::TableNextRow();
448 ImGui::TableNextColumn();
449 if (is_classic_active) {
450 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
453 if (ImGui::Button(
"Classic YAZE", ImVec2(-1, 30))) {
454 theme_manager.ApplyClassicYazeTheme();
455 ref_saved_style = style;
458 if (is_classic_active) {
459 ImGui::PopStyleColor();
462 if (ImGui::Button(
"Reset ColorsYaze", ImVec2(-1, 30))) {
464 ref_saved_style = style;
468 ImGui::TableNextColumn();
469 auto available_themes = theme_manager.GetAvailableThemes();
470 const char* current_file_theme =
"";
473 for (
const auto& theme_name : available_themes) {
474 if (theme_name == current_theme_name) {
475 current_file_theme = theme_name.c_str();
480 ImGui::SetNextItemWidth(-1);
481 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
482 for (
const auto& theme_name : available_themes) {
483 bool is_selected = (theme_name == current_theme_name);
484 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
485 theme_manager.LoadTheme(theme_name);
486 ref_saved_style = style;
492 if (ImGui::Button(
"Refresh Themes", ImVec2(-1, 30))) {
493 theme_manager.RefreshAvailableThemes();
497 ImGui::TableNextColumn();
498 if (ImGui::Button(
"Theme Selector", ImVec2(-1, 30))) {
499 show_theme_selector =
true;
502 if (ImGui::Button(
"Theme Editor", ImVec2(-1, 30))) {
503 show_theme_editor =
true;
510 if (show_theme_selector) {
511 theme_manager.ShowThemeSelector(&show_theme_selector);
514 if (show_theme_editor) {
515 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
523 bg_renderer.DrawSettingsUI();
527 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
528 ref_saved_style = style;
529 ImGui::ShowFontSelector(
"Fonts##Selector");
533 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
535 style.GrabRounding = style.FrameRounding;
538 bool border = (style.WindowBorderSize > 0.0f);
539 if (ImGui::Checkbox(
"WindowBorder", &border)) {
540 style.WindowBorderSize = border ? 1.0f : 0.0f;
545 bool border = (style.FrameBorderSize > 0.0f);
546 if (ImGui::Checkbox(
"FrameBorder", &border)) {
547 style.FrameBorderSize = border ? 1.0f : 0.0f;
552 bool border = (style.PopupBorderSize > 0.0f);
553 if (ImGui::Checkbox(
"PopupBorder", &border)) {
554 style.PopupBorderSize = border ? 1.0f : 0.0f;
559 if (ImGui::Button(
"Save Ref"))
560 *ref = ref_saved_style = style;
562 if (ImGui::Button(
"Revert Ref"))
568 if (ImGui::BeginTabBar(
"##tabs", ImGuiTabBarFlags_None)) {
569 if (ImGui::BeginTabItem(
"Sizes")) {
570 ImGui::SeparatorText(
"Main");
571 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
573 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
575 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
577 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
578 0.0f, 20.0f,
"%.0f");
579 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
580 0.0f, 10.0f,
"%.0f");
581 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
583 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
585 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
588 ImGui::SeparatorText(
"Borders");
589 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
591 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
593 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
595 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
597 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
599 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
602 ImGui::SeparatorText(
"Rounding");
603 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
605 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
607 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
609 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
611 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
613 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
615 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
618 ImGui::SeparatorText(
"Tables");
619 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
621 ImGui::SliderAngle(
"TableAngledHeadersAngle",
622 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
624 ImGui::SeparatorText(
"Widgets");
625 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
627 ImGui::Combo(
"ColorButtonPosition", (
int*)&style.ColorButtonPosition,
629 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
633 ImGui::SliderFloat2(
"SelectableTextAlign",
634 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
638 ImGui::SliderFloat(
"SeparatorTextBorderSize",
639 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
640 ImGui::SliderFloat2(
"SeparatorTextAlign",
641 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
643 ImGui::SliderFloat2(
"SeparatorTextPadding",
644 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
646 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
649 ImGui::SeparatorText(
"Tooltips");
650 for (
int n = 0; n < 2; n++)
651 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
652 :
"HoverFlagsForTooltipNav")) {
653 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
654 : &style.HoverFlagsForTooltipNav;
655 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
656 ImGuiHoveredFlags_DelayNone);
657 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
658 ImGuiHoveredFlags_DelayShort);
659 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
660 ImGuiHoveredFlags_DelayNormal);
661 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
662 ImGuiHoveredFlags_Stationary);
663 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
664 ImGuiHoveredFlags_NoSharedDelay);
668 ImGui::SeparatorText(
"Misc");
669 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
670 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
677 if (ImGui::BeginTabItem(
"Colors")) {
678 static int output_dest = 0;
679 static bool output_only_modified =
true;
680 if (ImGui::Button(
"Export")) {
681 if (output_dest == 0)
682 ImGui::LogToClipboard();
685 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
686 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
687 const ImVec4& col = style.Colors[i];
688 const char* name = ImGui::GetStyleColorName(i);
689 if (!output_only_modified ||
690 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
692 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
693 "%.2ff);" IM_NEWLINE,
694 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
699 ImGui::SetNextItemWidth(120);
700 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
702 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
704 static ImGuiTextFilter filter;
705 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
707 static ImGuiColorEditFlags alpha_flags = 0;
708 if (ImGui::RadioButton(
"Opaque",
709 alpha_flags == ImGuiColorEditFlags_None)) {
710 alpha_flags = ImGuiColorEditFlags_None;
713 if (ImGui::RadioButton(
"Alpha",
714 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
715 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
718 if (ImGui::RadioButton(
719 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
720 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
724 ImGui::SetNextWindowSizeConstraints(
725 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
726 ImVec2(FLT_MAX, FLT_MAX));
727 ImGui::BeginChild(
"##colors", ImVec2(0, 0),
728 ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened,
729 ImGuiWindowFlags_AlwaysVerticalScrollbar |
730 ImGuiWindowFlags_AlwaysHorizontalScrollbar);
731 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
732 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
733 const char* name = ImGui::GetStyleColorName(i);
734 if (!filter.PassFilter(name))
737 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
738 ImGuiColorEditFlags_AlphaBar | alpha_flags);
739 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
744 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
745 if (ImGui::Button(
"Save")) {
746 ref->Colors[i] = style.Colors[i];
748 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
749 if (ImGui::Button(
"Revert")) {
750 style.Colors[i] = ref->Colors[i];
753 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
754 ImGui::TextUnformatted(name);
757 ImGui::PopItemWidth();
763 if (ImGui::BeginTabItem(
"Fonts")) {
764 ImGuiIO& io = ImGui::GetIO();
765 ImFontAtlas* atlas = io.Fonts;
766 ImGui::ShowFontAtlas(atlas);
772 const float MIN_SCALE = 0.3f;
773 const float MAX_SCALE = 2.0f;
775 static float window_scale = 1.0f;
776 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
777 if (ImGui::DragFloat(
778 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
780 ImGuiSliderFlags_AlwaysClamp))
781 ImGui::SetWindowFontScale(window_scale);
784 ImGui::PopItemWidth();
789 if (ImGui::BeginTabItem(
"Rendering")) {
790 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
793 ImGui::Checkbox(
"Anti-aliased lines use texture",
794 &style.AntiAliasedLinesUseTex);
797 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
798 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
799 ImGui::DragFloat(
"Curve Tessellation Tolerance",
800 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
802 if (style.CurveTessellationTol < 0.10f)
803 style.CurveTessellationTol = 0.10f;
807 ImGui::DragFloat(
"Circle Tessellation Max Error",
808 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
809 "%.2f", ImGuiSliderFlags_AlwaysClamp);
810 const bool show_samples = ImGui::IsItemActive();
812 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
813 if (show_samples && ImGui::BeginTooltip()) {
814 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
816 ImDrawList* draw_list = ImGui::GetWindowDrawList();
817 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
818 for (
int n = 0; n < 8; n++) {
819 const float RAD_MIN = 5.0f;
820 const float RAD_MAX = 70.0f;
822 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
826 ImGui::Text(
"R: %.f\nN: %d", rad,
827 draw_list->_CalcCircleAutoSegmentCount(rad));
829 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
830 const float offset_x = floorf(canvas_width * 0.5f);
831 const float offset_y = floorf(RAD_MAX);
833 const ImVec2 p1 = ImGui::GetCursorScreenPos();
834 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
835 ImGui::GetColorU32(ImGuiCol_Text));
836 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
852 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
857 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
861 ImGui::PopItemWidth();
869 ImGui::PopItemWidth();
874 ImGuiStyle& style = ImGui::GetStyle();
875 static ImGuiStyle ref_saved_style;
878 static bool init =
true;
879 if (init && ref == NULL)
880 ref_saved_style = style;
883 ref = &ref_saved_style;
885 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
888 if (ImGui::CollapsingHeader(
"Theme Management",
889 ImGuiTreeNodeFlags_DefaultOpen)) {
895 std::string current_theme_name = theme_manager.GetCurrentThemeName();
896 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
899 if (is_classic_active) {
900 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
901 current_theme_name.c_str());
903 ImGui::Text(
"%s", current_theme_name.c_str());
907 auto current_theme = theme_manager.GetCurrentTheme();
909 ImGui::ColorButton(
"##primary_preview",
911 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
913 ImGui::ColorButton(
"##secondary_preview",
915 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
917 ImGui::ColorButton(
"##accent_preview",
919 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
924 if (is_classic_active) {
925 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
928 if (ImGui::Button(
"Classic YAZE")) {
929 theme_manager.ApplyClassicYazeTheme();
930 ref_saved_style = style;
933 if (is_classic_active) {
934 ImGui::PopStyleColor();
938 if (ImGui::Button(
"Reset ColorsYaze")) {
940 ref_saved_style = style;
944 auto available_themes = theme_manager.GetAvailableThemes();
945 const char* current_file_theme =
"";
948 for (
const auto& theme_name : available_themes) {
949 if (theme_name == current_theme_name) {
950 current_file_theme = theme_name.c_str();
955 ImGui::Text(
"File Themes:");
956 ImGui::SetNextItemWidth(-1);
957 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
958 for (
const auto& theme_name : available_themes) {
959 bool is_selected = (theme_name == current_theme_name);
960 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
961 theme_manager.LoadTheme(theme_name);
962 ref_saved_style = style;
968 if (ImGui::Button(
"Refresh Themes")) {
969 theme_manager.RefreshAvailableThemes();
972 if (ImGui::Button(
"Open Theme Editor")) {
973 static bool show_theme_editor =
true;
974 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
982 bg_renderer.DrawSettingsUI();
986 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
987 ref_saved_style = style;
988 ImGui::ShowFontSelector(
"Fonts##Selector");
991 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
993 style.GrabRounding = style.FrameRounding;
996 bool window_border = (style.WindowBorderSize > 0.0f);
997 if (ImGui::Checkbox(
"WindowBorder", &window_border)) {
998 style.WindowBorderSize = window_border ? 1.0f : 0.0f;
1002 bool frame_border = (style.FrameBorderSize > 0.0f);
1003 if (ImGui::Checkbox(
"FrameBorder", &frame_border)) {
1004 style.FrameBorderSize = frame_border ? 1.0f : 0.0f;
1008 bool popup_border = (style.PopupBorderSize > 0.0f);
1009 if (ImGui::Checkbox(
"PopupBorder", &popup_border)) {
1010 style.PopupBorderSize = popup_border ? 1.0f : 0.0f;
1014 if (ImGui::Button(
"Save Ref"))
1015 *ref = ref_saved_style = style;
1017 if (ImGui::Button(
"Revert Ref"))
1023 if (ImGui::BeginTabBar(
"DisplaySettingsTabs", ImGuiTabBarFlags_None)) {
1024 if (ImGui::BeginTabItem(
"Sizes")) {
1025 ImGui::SeparatorText(
"Main");
1026 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
1028 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
1030 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
1032 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
1033 0.0f, 20.0f,
"%.0f");
1034 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
1035 0.0f, 10.0f,
"%.0f");
1036 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
1038 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
1040 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
1043 ImGui::SeparatorText(
"Borders");
1044 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
1046 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
1048 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
1050 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
1052 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
1054 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
1057 ImGui::SeparatorText(
"Rounding");
1058 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
1060 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
1062 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
1064 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
1066 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
1068 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
1070 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
1073 ImGui::SeparatorText(
"Tables");
1074 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
1076 ImGui::SliderAngle(
"TableAngledHeadersAngle",
1077 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
1079 ImGui::SeparatorText(
"Widgets");
1080 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
1081 0.0f, 1.0f,
"%.2f");
1082 ImGui::Combo(
"ColorButtonPosition", (
int*)&style.ColorButtonPosition,
1084 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
1085 0.0f, 1.0f,
"%.2f");
1088 ImGui::SliderFloat2(
"SelectableTextAlign",
1089 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
1093 ImGui::SliderFloat(
"SeparatorTextBorderSize",
1094 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
1095 ImGui::SliderFloat2(
"SeparatorTextAlign",
1096 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
1098 ImGui::SliderFloat2(
"SeparatorTextPadding",
1099 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
1101 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
1104 ImGui::SeparatorText(
"Tooltips");
1105 for (
int n = 0; n < 2; n++)
1106 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
1107 :
"HoverFlagsForTooltipNav")) {
1108 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
1109 : &style.HoverFlagsForTooltipNav;
1110 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
1111 ImGuiHoveredFlags_DelayNone);
1112 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
1113 ImGuiHoveredFlags_DelayShort);
1114 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
1115 ImGuiHoveredFlags_DelayNormal);
1116 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
1117 ImGuiHoveredFlags_Stationary);
1118 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
1119 ImGuiHoveredFlags_NoSharedDelay);
1123 ImGui::SeparatorText(
"Misc");
1124 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
1125 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
1129 ImGui::EndTabItem();
1132 if (ImGui::BeginTabItem(
"Colors")) {
1133 static int output_dest = 0;
1134 static bool output_only_modified =
true;
1135 if (ImGui::Button(
"Export")) {
1136 if (output_dest == 0)
1137 ImGui::LogToClipboard();
1140 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
1141 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1142 const ImVec4& col = style.Colors[i];
1143 const char* name = ImGui::GetStyleColorName(i);
1144 if (!output_only_modified ||
1145 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
1147 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
1148 "%.2ff);" IM_NEWLINE,
1149 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
1154 ImGui::SetNextItemWidth(120);
1155 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
1157 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
1159 static ImGuiTextFilter filter;
1160 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
1162 static ImGuiColorEditFlags alpha_flags = 0;
1163 if (ImGui::RadioButton(
"Opaque",
1164 alpha_flags == ImGuiColorEditFlags_None)) {
1165 alpha_flags = ImGuiColorEditFlags_None;
1168 if (ImGui::RadioButton(
"Alpha",
1169 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
1170 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
1173 if (ImGui::RadioButton(
1174 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
1175 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
1179 ImGui::SetNextWindowSizeConstraints(
1180 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
1181 ImVec2(FLT_MAX, FLT_MAX));
1182 ImGui::BeginChild(
"##colors", ImVec2(0, 0),
1183 ImGuiChildFlags_Borders | ImGuiChildFlags_NavFlattened,
1184 ImGuiWindowFlags_AlwaysVerticalScrollbar |
1185 ImGuiWindowFlags_AlwaysHorizontalScrollbar);
1186 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
1187 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1188 const char* name = ImGui::GetStyleColorName(i);
1189 if (!filter.PassFilter(name))
1192 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
1193 ImGuiColorEditFlags_AlphaBar | alpha_flags);
1194 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
1199 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1200 if (ImGui::Button(
"Save")) {
1201 ref->Colors[i] = style.Colors[i];
1203 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1204 if (ImGui::Button(
"Revert")) {
1205 style.Colors[i] = ref->Colors[i];
1208 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1209 ImGui::TextUnformatted(name);
1212 ImGui::PopItemWidth();
1215 ImGui::EndTabItem();
1218 if (ImGui::BeginTabItem(
"Fonts")) {
1219 ImGuiIO& io = ImGui::GetIO();
1220 ImFontAtlas* atlas = io.Fonts;
1221 ImGui::ShowFontAtlas(atlas);
1227 const float MIN_SCALE = 0.3f;
1228 const float MAX_SCALE = 2.0f;
1230 static float window_scale = 1.0f;
1231 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1232 if (ImGui::DragFloat(
1233 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
1235 ImGuiSliderFlags_AlwaysClamp))
1236 ImGui::SetWindowFontScale(window_scale);
1239 ImGui::PopItemWidth();
1241 ImGui::EndTabItem();
1244 if (ImGui::BeginTabItem(
"Rendering")) {
1245 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
1248 ImGui::Checkbox(
"Anti-aliased lines use texture",
1249 &style.AntiAliasedLinesUseTex);
1252 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
1253 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1254 ImGui::DragFloat(
"Curve Tessellation Tolerance",
1255 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
1257 if (style.CurveTessellationTol < 0.10f)
1258 style.CurveTessellationTol = 0.10f;
1262 ImGui::DragFloat(
"Circle Tessellation Max Error",
1263 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
1264 "%.2f", ImGuiSliderFlags_AlwaysClamp);
1265 const bool show_samples = ImGui::IsItemActive();
1267 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
1268 if (show_samples && ImGui::BeginTooltip()) {
1269 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
1271 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1272 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
1273 for (
int n = 0; n < 8; n++) {
1274 const float RAD_MIN = 5.0f;
1275 const float RAD_MAX = 70.0f;
1277 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
1279 ImGui::BeginGroup();
1281 ImGui::Text(
"R: %.f\nN: %d", rad,
1282 draw_list->_CalcCircleAutoSegmentCount(rad));
1284 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
1285 const float offset_x = floorf(canvas_width * 0.5f);
1286 const float offset_y = floorf(RAD_MAX);
1288 const ImVec2 p1 = ImGui::GetCursorScreenPos();
1289 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
1290 ImGui::GetColorU32(ImGuiCol_Text));
1291 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
1296 ImGui::EndTooltip();
1300 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
1305 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
1309 ImGui::PopItemWidth();
1311 ImGui::EndTabItem();
1317 ImGui::PopItemWidth();