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);
779 ImGui::PopItemWidth();
784 if (ImGui::BeginTabItem(
"Rendering")) {
785 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
788 ImGui::Checkbox(
"Anti-aliased lines use texture",
789 &style.AntiAliasedLinesUseTex);
792 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
793 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
794 ImGui::DragFloat(
"Curve Tessellation Tolerance",
795 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
797 if (style.CurveTessellationTol < 0.10f)
798 style.CurveTessellationTol = 0.10f;
802 ImGui::DragFloat(
"Circle Tessellation Max Error",
803 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
804 "%.2f", ImGuiSliderFlags_AlwaysClamp);
805 const bool show_samples = ImGui::IsItemActive();
807 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
808 if (show_samples && ImGui::BeginTooltip()) {
809 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
811 ImDrawList* draw_list = ImGui::GetWindowDrawList();
812 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
813 for (
int n = 0; n < 8; n++) {
814 const float RAD_MIN = 5.0f;
815 const float RAD_MAX = 70.0f;
817 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
821 ImGui::Text(
"R: %.f\nN: %d", rad,
822 draw_list->_CalcCircleAutoSegmentCount(rad));
824 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
825 const float offset_x = floorf(canvas_width * 0.5f);
826 const float offset_y = floorf(RAD_MAX);
828 const ImVec2 p1 = ImGui::GetCursorScreenPos();
829 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
830 ImGui::GetColorU32(ImGuiCol_Text));
831 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
847 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
852 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
856 ImGui::PopItemWidth();
864 ImGui::PopItemWidth();
869 ImGuiStyle& style = ImGui::GetStyle();
870 static ImGuiStyle ref_saved_style;
873 static bool init =
true;
874 if (init && ref == NULL)
875 ref_saved_style = style;
878 ref = &ref_saved_style;
880 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.50f);
883 if (ImGui::CollapsingHeader(
"Theme Management",
884 ImGuiTreeNodeFlags_DefaultOpen)) {
890 std::string current_theme_name = theme_manager.GetCurrentThemeName();
891 bool is_classic_active = (current_theme_name ==
"Classic YAZE");
894 if (is_classic_active) {
895 ImGui::TextColored(ImVec4(0.2f, 0.8f, 0.2f, 1.0f),
"%s",
896 current_theme_name.c_str());
898 ImGui::Text(
"%s", current_theme_name.c_str());
902 auto current_theme = theme_manager.GetCurrentTheme();
904 ImGui::ColorButton(
"##primary_preview",
906 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
908 ImGui::ColorButton(
"##secondary_preview",
910 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
912 ImGui::ColorButton(
"##accent_preview",
914 ImGuiColorEditFlags_NoTooltip, ImVec2(20, 20));
919 if (is_classic_active) {
920 ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.6f, 0.2f, 1.0f));
923 if (ImGui::Button(
"Classic YAZE")) {
924 theme_manager.ApplyClassicYazeTheme();
925 ref_saved_style = style;
928 if (is_classic_active) {
929 ImGui::PopStyleColor();
933 if (ImGui::Button(
"Reset ColorsYaze")) {
935 ref_saved_style = style;
939 auto available_themes = theme_manager.GetAvailableThemes();
940 const char* current_file_theme =
"";
943 for (
const auto& theme_name : available_themes) {
944 if (theme_name == current_theme_name) {
945 current_file_theme = theme_name.c_str();
950 ImGui::Text(
"File Themes:");
951 ImGui::SetNextItemWidth(-1);
952 if (ImGui::BeginCombo(
"##FileThemes", current_file_theme)) {
953 for (
const auto& theme_name : available_themes) {
954 bool is_selected = (theme_name == current_theme_name);
955 if (ImGui::Selectable(theme_name.c_str(), is_selected)) {
956 theme_manager.LoadTheme(theme_name);
957 ref_saved_style = style;
963 if (ImGui::Button(
"Refresh Themes")) {
964 theme_manager.RefreshAvailableThemes();
967 if (ImGui::Button(
"Open Theme Editor")) {
968 static bool show_theme_editor =
true;
969 theme_manager.ShowSimpleThemeEditor(&show_theme_editor);
977 bg_renderer.DrawSettingsUI();
981 if (ImGui::ShowStyleSelector(
"Colors##Selector"))
982 ref_saved_style = style;
983 ImGui::ShowFontSelector(
"Fonts##Selector");
986 if (ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
988 style.GrabRounding = style.FrameRounding;
991 bool window_border = (style.WindowBorderSize > 0.0f);
992 if (ImGui::Checkbox(
"WindowBorder", &window_border)) {
993 style.WindowBorderSize = window_border ? 1.0f : 0.0f;
997 bool frame_border = (style.FrameBorderSize > 0.0f);
998 if (ImGui::Checkbox(
"FrameBorder", &frame_border)) {
999 style.FrameBorderSize = frame_border ? 1.0f : 0.0f;
1003 bool popup_border = (style.PopupBorderSize > 0.0f);
1004 if (ImGui::Checkbox(
"PopupBorder", &popup_border)) {
1005 style.PopupBorderSize = popup_border ? 1.0f : 0.0f;
1009 if (ImGui::Button(
"Save Ref"))
1010 *ref = ref_saved_style = style;
1012 if (ImGui::Button(
"Revert Ref"))
1018 if (ImGui::BeginTabBar(
"DisplaySettingsTabs", ImGuiTabBarFlags_None)) {
1019 if (ImGui::BeginTabItem(
"Sizes")) {
1020 ImGui::SeparatorText(
"Main");
1021 ImGui::SliderFloat2(
"WindowPadding", (
float*)&style.WindowPadding, 0.0f,
1023 ImGui::SliderFloat2(
"FramePadding", (
float*)&style.FramePadding, 0.0f,
1025 ImGui::SliderFloat2(
"ItemSpacing", (
float*)&style.ItemSpacing, 0.0f,
1027 ImGui::SliderFloat2(
"ItemInnerSpacing", (
float*)&style.ItemInnerSpacing,
1028 0.0f, 20.0f,
"%.0f");
1029 ImGui::SliderFloat2(
"TouchExtraPadding", (
float*)&style.TouchExtraPadding,
1030 0.0f, 10.0f,
"%.0f");
1031 ImGui::SliderFloat(
"IndentSpacing", &style.IndentSpacing, 0.0f, 30.0f,
1033 ImGui::SliderFloat(
"ScrollbarSize", &style.ScrollbarSize, 1.0f, 20.0f,
1035 ImGui::SliderFloat(
"GrabMinSize", &style.GrabMinSize, 1.0f, 20.0f,
1038 ImGui::SeparatorText(
"Borders");
1039 ImGui::SliderFloat(
"WindowBorderSize", &style.WindowBorderSize, 0.0f,
1041 ImGui::SliderFloat(
"ChildBorderSize", &style.ChildBorderSize, 0.0f, 1.0f,
1043 ImGui::SliderFloat(
"PopupBorderSize", &style.PopupBorderSize, 0.0f, 1.0f,
1045 ImGui::SliderFloat(
"FrameBorderSize", &style.FrameBorderSize, 0.0f, 1.0f,
1047 ImGui::SliderFloat(
"TabBorderSize", &style.TabBorderSize, 0.0f, 1.0f,
1049 ImGui::SliderFloat(
"TabBarBorderSize", &style.TabBarBorderSize, 0.0f,
1052 ImGui::SeparatorText(
"Rounding");
1053 ImGui::SliderFloat(
"WindowRounding", &style.WindowRounding, 0.0f, 12.0f,
1055 ImGui::SliderFloat(
"ChildRounding", &style.ChildRounding, 0.0f, 12.0f,
1057 ImGui::SliderFloat(
"FrameRounding", &style.FrameRounding, 0.0f, 12.0f,
1059 ImGui::SliderFloat(
"PopupRounding", &style.PopupRounding, 0.0f, 12.0f,
1061 ImGui::SliderFloat(
"ScrollbarRounding", &style.ScrollbarRounding, 0.0f,
1063 ImGui::SliderFloat(
"GrabRounding", &style.GrabRounding, 0.0f, 12.0f,
1065 ImGui::SliderFloat(
"TabRounding", &style.TabRounding, 0.0f, 12.0f,
1068 ImGui::SeparatorText(
"Tables");
1069 ImGui::SliderFloat2(
"CellPadding", (
float*)&style.CellPadding, 0.0f,
1071 ImGui::SliderAngle(
"TableAngledHeadersAngle",
1072 &style.TableAngledHeadersAngle, -50.0f, +50.0f);
1074 ImGui::SeparatorText(
"Widgets");
1075 ImGui::SliderFloat2(
"WindowTitleAlign", (
float*)&style.WindowTitleAlign,
1076 0.0f, 1.0f,
"%.2f");
1077 ImGui::Combo(
"ColorButtonPosition", (
int*)&style.ColorButtonPosition,
1079 ImGui::SliderFloat2(
"ButtonTextAlign", (
float*)&style.ButtonTextAlign,
1080 0.0f, 1.0f,
"%.2f");
1083 ImGui::SliderFloat2(
"SelectableTextAlign",
1084 (
float*)&style.SelectableTextAlign, 0.0f, 1.0f,
1088 ImGui::SliderFloat(
"SeparatorTextBorderSize",
1089 &style.SeparatorTextBorderSize, 0.0f, 10.0f,
"%.0f");
1090 ImGui::SliderFloat2(
"SeparatorTextAlign",
1091 (
float*)&style.SeparatorTextAlign, 0.0f, 1.0f,
1093 ImGui::SliderFloat2(
"SeparatorTextPadding",
1094 (
float*)&style.SeparatorTextPadding, 0.0f, 40.0f,
1096 ImGui::SliderFloat(
"LogSliderDeadzone", &style.LogSliderDeadzone, 0.0f,
1099 ImGui::SeparatorText(
"Tooltips");
1100 for (
int n = 0; n < 2; n++)
1101 if (ImGui::TreeNodeEx(n == 0 ?
"HoverFlagsForTooltipMouse"
1102 :
"HoverFlagsForTooltipNav")) {
1103 ImGuiHoveredFlags* p = (n == 0) ? &style.HoverFlagsForTooltipMouse
1104 : &style.HoverFlagsForTooltipNav;
1105 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNone", p,
1106 ImGuiHoveredFlags_DelayNone);
1107 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayShort", p,
1108 ImGuiHoveredFlags_DelayShort);
1109 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_DelayNormal", p,
1110 ImGuiHoveredFlags_DelayNormal);
1111 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_Stationary", p,
1112 ImGuiHoveredFlags_Stationary);
1113 ImGui::CheckboxFlags(
"ImGuiHoveredFlags_NoSharedDelay", p,
1114 ImGuiHoveredFlags_NoSharedDelay);
1118 ImGui::SeparatorText(
"Misc");
1119 ImGui::SliderFloat2(
"DisplaySafeAreaPadding",
1120 (
float*)&style.DisplaySafeAreaPadding, 0.0f, 30.0f,
1124 ImGui::EndTabItem();
1127 if (ImGui::BeginTabItem(
"Colors")) {
1128 static int output_dest = 0;
1129 static bool output_only_modified =
true;
1130 if (ImGui::Button(
"Export")) {
1131 if (output_dest == 0)
1132 ImGui::LogToClipboard();
1135 ImGui::LogText(
"ImVec4* colors = ImGui::GetStyle().Colors;" IM_NEWLINE);
1136 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1137 const ImVec4& col = style.Colors[i];
1138 const char* name = ImGui::GetStyleColorName(i);
1139 if (!output_only_modified ||
1140 memcmp(&col, &ref->Colors[i],
sizeof(ImVec4)) != 0)
1142 "colors[ImGuiCol_%s]%*s= ImVec4(%.2ff, %.2ff, %.2ff, "
1143 "%.2ff);" IM_NEWLINE,
1144 name, 23 - (
int)strlen(name),
"", col.x, col.y, col.z, col.w);
1149 ImGui::SetNextItemWidth(120);
1150 ImGui::Combo(
"##output_type", &output_dest,
"To Clipboard\0To TTY\0");
1152 ImGui::Checkbox(
"Only Modified Colors", &output_only_modified);
1154 static ImGuiTextFilter filter;
1155 filter.Draw(
"Filter colors", ImGui::GetFontSize() * 16);
1157 static ImGuiColorEditFlags alpha_flags = 0;
1158 if (ImGui::RadioButton(
"Opaque",
1159 alpha_flags == ImGuiColorEditFlags_None)) {
1160 alpha_flags = ImGuiColorEditFlags_None;
1163 if (ImGui::RadioButton(
"Alpha",
1164 alpha_flags == ImGuiColorEditFlags_AlphaPreview)) {
1165 alpha_flags = ImGuiColorEditFlags_AlphaPreview;
1168 if (ImGui::RadioButton(
1169 "Both", alpha_flags == ImGuiColorEditFlags_AlphaPreviewHalf)) {
1170 alpha_flags = ImGuiColorEditFlags_AlphaPreviewHalf;
1174 ImGui::SetNextWindowSizeConstraints(
1175 ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 10),
1176 ImVec2(FLT_MAX, FLT_MAX));
1177 ImGui::BeginChild(
"##colors", ImVec2(0, 0), ImGuiChildFlags_Border,
1178 ImGuiWindowFlags_AlwaysVerticalScrollbar |
1179 ImGuiWindowFlags_AlwaysHorizontalScrollbar |
1180 ImGuiWindowFlags_NavFlattened);
1181 ImGui::PushItemWidth(ImGui::GetFontSize() * -12);
1182 for (
int i = 0; i < ImGuiCol_COUNT; i++) {
1183 const char* name = ImGui::GetStyleColorName(i);
1184 if (!filter.PassFilter(name))
1187 ImGui::ColorEdit4(
"##color", (
float*)&style.Colors[i],
1188 ImGuiColorEditFlags_AlphaBar | alpha_flags);
1189 if (memcmp(&style.Colors[i], &ref->Colors[i],
sizeof(ImVec4)) != 0) {
1194 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1195 if (ImGui::Button(
"Save")) {
1196 ref->Colors[i] = style.Colors[i];
1198 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1199 if (ImGui::Button(
"Revert")) {
1200 style.Colors[i] = ref->Colors[i];
1203 ImGui::SameLine(0.0f, style.ItemInnerSpacing.x);
1204 ImGui::TextUnformatted(name);
1207 ImGui::PopItemWidth();
1210 ImGui::EndTabItem();
1213 if (ImGui::BeginTabItem(
"Fonts")) {
1214 ImGuiIO& io = ImGui::GetIO();
1215 ImFontAtlas* atlas = io.Fonts;
1216 ImGui::ShowFontAtlas(atlas);
1222 const float MIN_SCALE = 0.3f;
1223 const float MAX_SCALE = 2.0f;
1225 static float window_scale = 1.0f;
1226 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1227 if (ImGui::DragFloat(
1228 "window scale", &window_scale, 0.005f, MIN_SCALE, MAX_SCALE,
1230 ImGuiSliderFlags_AlwaysClamp))
1231 ImGui::SetWindowFontScale(window_scale);
1234 ImGui::PopItemWidth();
1236 ImGui::EndTabItem();
1239 if (ImGui::BeginTabItem(
"Rendering")) {
1240 ImGui::Checkbox(
"Anti-aliased lines", &style.AntiAliasedLines);
1243 ImGui::Checkbox(
"Anti-aliased lines use texture",
1244 &style.AntiAliasedLinesUseTex);
1247 ImGui::Checkbox(
"Anti-aliased fill", &style.AntiAliasedFill);
1248 ImGui::PushItemWidth(ImGui::GetFontSize() * 8);
1249 ImGui::DragFloat(
"Curve Tessellation Tolerance",
1250 &style.CurveTessellationTol, 0.02f, 0.10f, 10.0f,
1252 if (style.CurveTessellationTol < 0.10f)
1253 style.CurveTessellationTol = 0.10f;
1257 ImGui::DragFloat(
"Circle Tessellation Max Error",
1258 &style.CircleTessellationMaxError, 0.005f, 0.10f, 5.0f,
1259 "%.2f", ImGuiSliderFlags_AlwaysClamp);
1260 const bool show_samples = ImGui::IsItemActive();
1262 ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
1263 if (show_samples && ImGui::BeginTooltip()) {
1264 ImGui::TextUnformatted(
"(R = radius, N = number of segments)");
1266 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1267 const float min_widget_width = ImGui::CalcTextSize(
"N: MMM\nR: MMM").x;
1268 for (
int n = 0; n < 8; n++) {
1269 const float RAD_MIN = 5.0f;
1270 const float RAD_MAX = 70.0f;
1272 RAD_MIN + (RAD_MAX - RAD_MIN) * (
float)n / (8.0f - 1.0f);
1274 ImGui::BeginGroup();
1276 ImGui::Text(
"R: %.f\nN: %d", rad,
1277 draw_list->_CalcCircleAutoSegmentCount(rad));
1279 const float canvas_width = std::max(min_widget_width, rad * 2.0f);
1280 const float offset_x = floorf(canvas_width * 0.5f);
1281 const float offset_y = floorf(RAD_MAX);
1283 const ImVec2 p1 = ImGui::GetCursorScreenPos();
1284 draw_list->AddCircle(ImVec2(p1.x + offset_x, p1.y + offset_y), rad,
1285 ImGui::GetColorU32(ImGuiCol_Text));
1286 ImGui::Dummy(ImVec2(canvas_width, RAD_MAX * 2));
1291 ImGui::EndTooltip();
1295 ImGui::DragFloat(
"Global Alpha", &style.Alpha, 0.005f, 0.20f, 1.0f,
1300 ImGui::DragFloat(
"Disabled Alpha", &style.DisabledAlpha, 0.005f, 0.0f,
1304 ImGui::PopItemWidth();
1306 ImGui::EndTabItem();
1312 ImGui::PopItemWidth();