| 88 | } |
| 89 | |
| 90 | void utils::ShowColorExportWindow(bool *child_colexp) |
| 91 | { |
| 92 | if (ImGui::Begin("Color Export", child_colexp, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse)) |
| 93 | { |
| 94 | static ImVec4 color = ImVec4(114.0f / 255.0f, 144.0f / 255.0f, 154.0f / 255.0f, 200.0f / 255.0f); |
| 95 | |
| 96 | static bool alpha_preview = true; |
| 97 | static bool alpha_half_preview = true; |
| 98 | static bool drag_and_drop = true; |
| 99 | static bool options_menu = true; |
| 100 | static bool hdr = false; |
| 101 | ImGuiColorEditFlags misc_flags = (hdr ? ImGuiColorEditFlags_HDR : 0) | |
| 102 | (drag_and_drop ? 0 : ImGuiColorEditFlags_NoDragDrop) | |
| 103 | (alpha_half_preview ? ImGuiColorEditFlags_AlphaPreviewHalf |
| 104 | : (alpha_preview ? ImGuiColorEditFlags_AlphaPreview : 0)) | |
| 105 | (options_menu ? 0 : ImGuiColorEditFlags_NoOptions); |
| 106 | |
| 107 | ImGui::Text("Color widget:"); |
| 108 | ImGui::SameLine(); |
| 109 | HelpMarker("Click on the color square to open a color picker.\n" |
| 110 | "CTRL+click on individual component to input value.\n"); |
| 111 | ImGui::ColorEdit3("MyColor##1", (float *)&color, misc_flags); |
| 112 | ImGui::SameLine(); |
| 113 | HelpMarker("Right click me to export colors with your preferred format."); |
| 114 | |
| 115 | ImGui::Text("Color widget HSV with Alpha:"); |
| 116 | ImGui::ColorEdit4("MyColor##2", (float *)&color, ImGuiColorEditFlags_DisplayHSV | misc_flags); |
| 117 | |
| 118 | ImGui::Text("Color widget with Float Display:"); |
| 119 | ImGui::ColorEdit4("MyColor##2f", (float *)&color, ImGuiColorEditFlags_Float | misc_flags); |
| 120 | |
| 121 | ImGui::Text("Color picker:"); |
| 122 | static bool alpha = true; |
| 123 | static bool alpha_bar = true; |
| 124 | static bool side_preview = true; |
| 125 | static bool ref_color = false; |
| 126 | static ImVec4 ref_color_v(1.0f, 0.0f, 1.0f, 0.5f); |
| 127 | static int display_mode = 0; |
| 128 | static int picker_mode = 2; |
| 129 | ImGui::Combo("Display Mode", &display_mode, "Auto/Current\0None\0RGB Only\0HSV Only\0Hex Only\0"); |
| 130 | ImGui::SameLine(); |
| 131 | HelpMarker("ColorEdit defaults to displaying RGB inputs if you don't specify a display mode, " |
| 132 | "but the user can change it with a right-click.\n\nColorPicker defaults to displaying RGB+HSV+Hex " |
| 133 | "if you don't specify a display mode.\n\nYou can change the defaults using SetColorEditOptions()."); |
| 134 | ImGui::Combo("Picker Mode", &picker_mode, "Auto/Current\0Hue bar + SV rect\0Hue wheel + SV triangle\0"); |
| 135 | ImGui::SameLine(); |
| 136 | HelpMarker("User can right-click the picker to change mode."); |
| 137 | ImGuiColorEditFlags flags = misc_flags; |
| 138 | if (!alpha) |
| 139 | flags |= |
| 140 | ImGuiColorEditFlags_NoAlpha; // This is by default if you call ColorPicker3() instead of ColorPicker4() |
| 141 | if (alpha_bar) |
| 142 | flags |= ImGuiColorEditFlags_AlphaBar; |
| 143 | if (!side_preview) |
| 144 | flags |= ImGuiColorEditFlags_NoSidePreview; |
| 145 | if (picker_mode == 1) |
| 146 | flags |= ImGuiColorEditFlags_PickerHueBar; |
| 147 | if (picker_mode == 2) |
nothing calls this directly
no test coverage detected