990 if (!p_open || !*p_open)
return;
992 ImGui::SetNextWindowSize(ImVec2(800, 600), ImGuiCond_FirstUseEver);
994 if (ImGui::Begin(absl::StrFormat(
"%s Theme Editor",
ICON_MD_PALETTE).c_str(), p_open,
995 ImGuiWindowFlags_MenuBar)) {
998 static float editor_animation_time = 0.0f;
999 editor_animation_time += ImGui::GetIO().DeltaTime;
1001 ImDrawList* draw_list = ImGui::GetWindowDrawList();
1002 ImVec2 window_pos = ImGui::GetWindowPos();
1003 ImVec2 window_size = ImGui::GetWindowSize();
1007 std::vector<gui::Color> theme_colors = {
1008 current_theme.primary, current_theme.secondary, current_theme.accent,
1009 current_theme.success, current_theme.warning, current_theme.error
1012 for (
size_t i = 0; i < theme_colors.size(); ++i) {
1013 float time_offset = i * 1.0f;
1014 float orbit_radius = 60.0f + i * 8.0f;
1015 float x = window_pos.x + window_size.x * 0.8f + cosf(editor_animation_time * 0.3f + time_offset) * orbit_radius;
1016 float y = window_pos.y + window_size.y * 0.3f + sinf(editor_animation_time * 0.3f + time_offset) * orbit_radius;
1018 float alpha = 0.15f + 0.1f * sinf(editor_animation_time * 1.5f + time_offset);
1019 ImU32 orb_color = ImGui::ColorConvertFloat4ToU32(ImVec4(
1020 theme_colors[i].red, theme_colors[i].green, theme_colors[i].blue, alpha));
1022 float radius = 4.0f + sinf(editor_animation_time * 2.0f + time_offset) * 1.0f;
1023 draw_list->AddCircleFilled(ImVec2(x, y), radius, orb_color);
1027 if (ImGui::BeginMenuBar()) {
1028 if (ImGui::BeginMenu(
"File")) {
1029 if (ImGui::MenuItem(absl::StrFormat(
"%s New Theme",
ICON_MD_ADD).c_str())) {
1035 if (!file_path.empty()) {
1040 if (ImGui::MenuItem(absl::StrFormat(
"%s Save Theme",
ICON_MD_SAVE).c_str())) {
1043 if (!current_file_path.empty()) {
1046 LOG_ERROR(
"Theme Manager",
"Failed to save theme");
1051 if (!file_path.empty()) {
1054 LOG_ERROR(
"Theme Manager",
"Failed to save theme");
1059 if (ImGui::MenuItem(absl::StrFormat(
"%s Save As...",
ICON_MD_SAVE_AS).c_str())) {
1062 if (!file_path.empty()) {
1065 LOG_ERROR(
"Theme Manager",
"Failed to save theme");
1072 if (ImGui::BeginMenu(
"Presets")) {
1073 if (ImGui::MenuItem(
"YAZE Classic")) {
1078 if (!available_themes.empty()) {
1080 for (
const auto& theme_name : available_themes) {
1081 if (ImGui::MenuItem(theme_name.c_str())) {
1089 ImGui::EndMenuBar();
1093 static char theme_name[128];
1094 static char theme_description[256];
1095 static char theme_author[128];
1096 static bool live_preview =
true;
1098 static bool theme_backup_made =
false;
1101 auto apply_live_preview = [&]() {
1103 if (!theme_backup_made) {
1105 theme_backup_made =
true;
1113 ImGui::Checkbox(
"Live Preview", &live_preview);
1115 ImGui::Text(
"| Changes apply immediately when enabled");
1118 static bool prev_live_preview = live_preview;
1119 if (prev_live_preview && !live_preview && theme_backup_made) {
1121 theme_backup_made =
false;
1123 prev_live_preview = live_preview;
1128 if (ImGui::BeginTable(
"ThemeMetadata", 2, ImGuiTableFlags_SizingStretchProp)) {
1129 ImGui::TableSetupColumn(
"Field", ImGuiTableColumnFlags_WidthFixed, 100.0f);
1130 ImGui::TableSetupColumn(
"Value", ImGuiTableColumnFlags_WidthStretch);
1132 ImGui::TableNextRow();
1133 ImGui::TableNextColumn();
1134 ImGui::AlignTextToFramePadding();
1135 ImGui::Text(
"Name:");
1136 ImGui::TableNextColumn();
1137 if (ImGui::InputText(
"##theme_name", theme_name,
sizeof(theme_name))) {
1138 edit_theme.
name = std::string(theme_name);
1141 ImGui::TableNextRow();
1142 ImGui::TableNextColumn();
1143 ImGui::AlignTextToFramePadding();
1144 ImGui::Text(
"Description:");
1145 ImGui::TableNextColumn();
1146 if (ImGui::InputText(
"##theme_description", theme_description,
sizeof(theme_description))) {
1147 edit_theme.
description = std::string(theme_description);
1150 ImGui::TableNextRow();
1151 ImGui::TableNextColumn();
1152 ImGui::AlignTextToFramePadding();
1153 ImGui::Text(
"Author:");
1154 ImGui::TableNextColumn();
1155 if (ImGui::InputText(
"##theme_author", theme_author,
sizeof(theme_author))) {
1156 edit_theme.
author = std::string(theme_author);
1165 if (ImGui::BeginTabBar(
"ThemeEditorTabs", ImGuiTabBarFlags_None)) {
1168 static bool first_frame =
true;
1169 if (first_frame && live_preview) {
1170 apply_live_preview();
1171 first_frame =
false;
1175 if (ImGui::BeginTabItem(absl::StrFormat(
"%s Primary",
ICON_MD_COLOR_LENS).c_str())) {
1176 if (ImGui::BeginTable(
"PrimaryColorsTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1177 ImGui::TableSetupColumn(
"Color", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1178 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1179 ImGui::TableSetupColumn(
"Preview", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1180 ImGui::TableHeadersRow();
1183 ImGui::TableNextRow();
1184 ImGui::TableNextColumn();
1185 ImGui::AlignTextToFramePadding();
1186 ImGui::Text(
"Primary:");
1187 ImGui::TableNextColumn();
1189 if (ImGui::ColorEdit3(
"##primary", &primary.x)) {
1190 edit_theme.
primary = {primary.x, primary.y, primary.z, primary.w};
1191 apply_live_preview();
1193 ImGui::TableNextColumn();
1194 ImGui::Button(
"Primary Preview", ImVec2(-1, 30));
1197 ImGui::TableNextRow();
1198 ImGui::TableNextColumn();
1199 ImGui::AlignTextToFramePadding();
1200 ImGui::Text(
"Secondary:");
1201 ImGui::TableNextColumn();
1203 if (ImGui::ColorEdit3(
"##secondary", &secondary.x)) {
1204 edit_theme.
secondary = {secondary.x, secondary.y, secondary.z, secondary.w};
1205 apply_live_preview();
1207 ImGui::TableNextColumn();
1208 ImGui::PushStyleColor(ImGuiCol_Button, secondary);
1209 ImGui::Button(
"Secondary Preview", ImVec2(-1, 30));
1210 ImGui::PopStyleColor();
1213 ImGui::TableNextRow();
1214 ImGui::TableNextColumn();
1215 ImGui::AlignTextToFramePadding();
1216 ImGui::Text(
"Accent:");
1217 ImGui::TableNextColumn();
1219 if (ImGui::ColorEdit3(
"##accent", &accent.x)) {
1220 edit_theme.
accent = {accent.x, accent.y, accent.z, accent.w};
1221 apply_live_preview();
1223 ImGui::TableNextColumn();
1224 ImGui::PushStyleColor(ImGuiCol_Button, accent);
1225 ImGui::Button(
"Accent Preview", ImVec2(-1, 30));
1226 ImGui::PopStyleColor();
1229 ImGui::TableNextRow();
1230 ImGui::TableNextColumn();
1231 ImGui::AlignTextToFramePadding();
1232 ImGui::Text(
"Background:");
1233 ImGui::TableNextColumn();
1235 if (ImGui::ColorEdit4(
"##background", &background.x)) {
1236 edit_theme.
background = {background.x, background.y, background.z, background.w};
1237 apply_live_preview();
1239 ImGui::TableNextColumn();
1240 ImGui::Text(
"Background preview shown in window");
1244 ImGui::EndTabItem();
1249 if (ImGui::BeginTable(
"TextColorsTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1250 ImGui::TableSetupColumn(
"Color", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1251 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1252 ImGui::TableSetupColumn(
"Preview", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1253 ImGui::TableHeadersRow();
1256 auto text_colors = std::vector<std::pair<const char*, Color*>>{
1267 for (
auto& [label, color_ptr] : text_colors) {
1268 ImGui::TableNextRow();
1269 ImGui::TableNextColumn();
1270 ImGui::AlignTextToFramePadding();
1271 ImGui::Text(
"%s:", label);
1273 ImGui::TableNextColumn();
1275 std::string
id = absl::StrFormat(
"##%s", label);
1276 if (ImGui::ColorEdit3(
id.c_str(), &color_vec.x)) {
1277 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1278 apply_live_preview();
1281 ImGui::TableNextColumn();
1282 ImGui::PushStyleColor(ImGuiCol_Text, color_vec);
1283 ImGui::Text(
"Sample %s", label);
1284 ImGui::PopStyleColor();
1289 ImGui::EndTabItem();
1293 if (ImGui::BeginTabItem(absl::StrFormat(
"%s Interactive",
ICON_MD_TOUCH_APP).c_str())) {
1294 if (ImGui::BeginTable(
"InteractiveColorsTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1295 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1296 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1297 ImGui::TableSetupColumn(
"Preview", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1298 ImGui::TableHeadersRow();
1301 auto interactive_colors = std::vector<std::tuple<const char*, Color*, ImGuiCol>>{
1302 {
"Button", &edit_theme.
button, ImGuiCol_Button},
1303 {
"Button Hovered", &edit_theme.
button_hovered, ImGuiCol_ButtonHovered},
1304 {
"Button Active", &edit_theme.
button_active, ImGuiCol_ButtonActive},
1305 {
"Frame Background", &edit_theme.
frame_bg, ImGuiCol_FrameBg},
1306 {
"Frame BG Hovered", &edit_theme.
frame_bg_hovered, ImGuiCol_FrameBgHovered},
1307 {
"Frame BG Active", &edit_theme.
frame_bg_active, ImGuiCol_FrameBgActive},
1308 {
"Check Mark", &edit_theme.
check_mark, ImGuiCol_CheckMark},
1309 {
"Slider Grab", &edit_theme.
slider_grab, ImGuiCol_SliderGrab},
1313 for (
auto& [label, color_ptr, imgui_col] : interactive_colors) {
1314 ImGui::TableNextRow();
1315 ImGui::TableNextColumn();
1316 ImGui::AlignTextToFramePadding();
1317 ImGui::Text(
"%s:", label);
1319 ImGui::TableNextColumn();
1321 std::string
id = absl::StrFormat(
"##%s", label);
1322 if (ImGui::ColorEdit3(
id.c_str(), &color_vec.x)) {
1323 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1324 apply_live_preview();
1327 ImGui::TableNextColumn();
1328 ImGui::PushStyleColor(imgui_col, color_vec);
1329 ImGui::Button(absl::StrFormat(
"Preview %s", label).c_str(), ImVec2(-1, 30));
1330 ImGui::PopStyleColor();
1335 ImGui::EndTabItem();
1339 if (ImGui::BeginTabItem(absl::StrFormat(
"%s Style",
ICON_MD_TUNE).c_str())) {
1340 ImGui::Text(
"Rounding and Border Settings:");
1342 if (ImGui::SliderFloat(
"Window Rounding", &edit_theme.
window_rounding, 0.0f, 20.0f)) {
1345 if (ImGui::SliderFloat(
"Frame Rounding", &edit_theme.
frame_rounding, 0.0f, 20.0f)) {
1348 if (ImGui::SliderFloat(
"Scrollbar Rounding", &edit_theme.
scrollbar_rounding, 0.0f, 20.0f)) {
1351 if (ImGui::SliderFloat(
"Tab Rounding", &edit_theme.
tab_rounding, 0.0f, 20.0f)) {
1354 if (ImGui::SliderFloat(
"Grab Rounding", &edit_theme.
grab_rounding, 0.0f, 20.0f)) {
1359 ImGui::Text(
"Border Sizes:");
1361 if (ImGui::SliderFloat(
"Window Border Size", &edit_theme.
window_border_size, 0.0f, 3.0f)) {
1364 if (ImGui::SliderFloat(
"Frame Border Size", &edit_theme.
frame_border_size, 0.0f, 3.0f)) {
1369 ImGui::Text(
"Animation & Effects:");
1375 if (ImGui::SliderFloat(
"Animation Speed", &edit_theme.
animation_speed, 0.1f, 3.0f)) {
1376 apply_live_preview();
1383 ImGui::EndTabItem();
1387 if (ImGui::BeginTabItem(absl::StrFormat(
"%s Navigation",
ICON_MD_NAVIGATION).c_str())) {
1388 if (ImGui::BeginTable(
"NavigationTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1389 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1390 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1391 ImGui::TableSetupColumn(
"Preview", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1392 ImGui::TableHeadersRow();
1395 auto window_colors = std::vector<std::tuple<const char*, Color*, const char*>>{
1396 {
"Window Background", &edit_theme.
window_bg,
"Main window background"},
1397 {
"Child Background", &edit_theme.
child_bg,
"Child window background"},
1398 {
"Popup Background", &edit_theme.
popup_bg,
"Popup window background"},
1399 {
"Modal Background", &edit_theme.
modal_bg,
"Modal window background"},
1400 {
"Menu Bar BG", &edit_theme.
menu_bar_bg,
"Menu bar background"}
1403 for (
auto& [label, color_ptr, description] : window_colors) {
1404 ImGui::TableNextRow();
1405 ImGui::TableNextColumn();
1406 ImGui::AlignTextToFramePadding();
1407 ImGui::Text(
"%s:", label);
1409 ImGui::TableNextColumn();
1411 std::string
id = absl::StrFormat(
"##window_%s", label);
1412 if (ImGui::ColorEdit4(
id.c_str(), &color_vec.x)) {
1413 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1414 apply_live_preview();
1417 ImGui::TableNextColumn();
1418 ImGui::TextWrapped(
"%s", description);
1427 if (ImGui::CollapsingHeader(
"Headers & Tabs", ImGuiTreeNodeFlags_DefaultOpen)) {
1428 if (ImGui::BeginTable(
"HeaderTabTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1429 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1430 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1431 ImGui::TableSetupColumn(
"Preview", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1432 ImGui::TableHeadersRow();
1434 auto header_tab_colors = std::vector<std::pair<const char*, Color*>>{
1435 {
"Header", &edit_theme.
header},
1438 {
"Tab", &edit_theme.
tab},
1445 {
"Title Background", &edit_theme.
title_bg},
1450 for (
auto& [label, color_ptr] : header_tab_colors) {
1451 ImGui::TableNextRow();
1452 ImGui::TableNextColumn();
1453 ImGui::AlignTextToFramePadding();
1454 ImGui::Text(
"%s:", label);
1456 ImGui::TableNextColumn();
1458 std::string
id = absl::StrFormat(
"##header_%s", label);
1459 if (ImGui::ColorEdit3(
id.c_str(), &color_vec.x)) {
1460 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1461 apply_live_preview();
1464 ImGui::TableNextColumn();
1465 ImGui::PushStyleColor(ImGuiCol_Button, color_vec);
1466 ImGui::Button(absl::StrFormat(
"Preview %s", label).c_str(), ImVec2(-1, 25));
1467 ImGui::PopStyleColor();
1475 if (ImGui::CollapsingHeader(
"Navigation & Special")) {
1476 if (ImGui::BeginTable(
"NavSpecialTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1477 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1478 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1479 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1480 ImGui::TableHeadersRow();
1482 auto nav_special_colors = std::vector<std::tuple<const char*, Color*, const char*>>{
1483 {
"Nav Cursor", &edit_theme.
nav_cursor,
"Navigation cursor color"},
1487 {
"Drag Drop Target", &edit_theme.
drag_drop_target,
"Drag and drop target highlight"},
1488 {
"Docking Preview", &edit_theme.
docking_preview,
"Docking area preview"},
1489 {
"Docking Empty BG", &edit_theme.
docking_empty_bg,
"Empty docking space background"}
1492 for (
auto& [label, color_ptr, description] : nav_special_colors) {
1493 ImGui::TableNextRow();
1494 ImGui::TableNextColumn();
1495 ImGui::AlignTextToFramePadding();
1496 ImGui::Text(
"%s:", label);
1498 ImGui::TableNextColumn();
1500 std::string
id = absl::StrFormat(
"##nav_%s", label);
1501 if (ImGui::ColorEdit4(
id.c_str(), &color_vec.x)) {
1502 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1503 apply_live_preview();
1506 ImGui::TableNextColumn();
1507 ImGui::TextWrapped(
"%s", description);
1514 ImGui::EndTabItem();
1519 if (ImGui::BeginTable(
"TablesDataTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1520 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1521 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1522 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1523 ImGui::TableHeadersRow();
1525 auto table_colors = std::vector<std::tuple<const char*, Color*, const char*>>{
1526 {
"Table Header BG", &edit_theme.
table_header_bg,
"Table column headers"},
1529 {
"Table Row BG", &edit_theme.
table_row_bg,
"Normal table rows"},
1530 {
"Table Row BG Alt", &edit_theme.
table_row_bg_alt,
"Alternating table rows"},
1531 {
"Tree Lines", &edit_theme.
tree_lines,
"Tree view connection lines"}
1534 for (
auto& [label, color_ptr, description] : table_colors) {
1535 ImGui::TableNextRow();
1536 ImGui::TableNextColumn();
1537 ImGui::AlignTextToFramePadding();
1538 ImGui::Text(
"%s:", label);
1540 ImGui::TableNextColumn();
1542 std::string
id = absl::StrFormat(
"##table_%s", label);
1543 if (ImGui::ColorEdit4(
id.c_str(), &color_vec.x)) {
1544 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1545 apply_live_preview();
1548 ImGui::TableNextColumn();
1549 ImGui::TextWrapped(
"%s", description);
1558 if (ImGui::CollapsingHeader(
"Plots & Graphs")) {
1559 if (ImGui::BeginTable(
"PlotsTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1560 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1561 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1562 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1563 ImGui::TableHeadersRow();
1565 auto plot_colors = std::vector<std::tuple<const char*, Color*, const char*>>{
1566 {
"Plot Lines", &edit_theme.
plot_lines,
"Line plot color"},
1568 {
"Plot Histogram", &edit_theme.
plot_histogram,
"Histogram fill color"},
1572 for (
auto& [label, color_ptr, description] : plot_colors) {
1573 ImGui::TableNextRow();
1574 ImGui::TableNextColumn();
1575 ImGui::AlignTextToFramePadding();
1576 ImGui::Text(
"%s:", label);
1578 ImGui::TableNextColumn();
1580 std::string
id = absl::StrFormat(
"##plot_%s", label);
1581 if (ImGui::ColorEdit3(
id.c_str(), &color_vec.x)) {
1582 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1583 apply_live_preview();
1586 ImGui::TableNextColumn();
1587 ImGui::TextWrapped(
"%s", description);
1594 ImGui::EndTabItem();
1598 if (ImGui::BeginTabItem(absl::StrFormat(
"%s Borders",
ICON_MD_BORDER_ALL).c_str())) {
1599 if (ImGui::BeginTable(
"BordersControlsTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1600 ImGui::TableSetupColumn(
"Element", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1601 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1602 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1603 ImGui::TableHeadersRow();
1605 auto border_control_colors = std::vector<std::tuple<const char*, Color*, const char*>>{
1606 {
"Border", &edit_theme.
border,
"General border color"},
1607 {
"Border Shadow", &edit_theme.
border_shadow,
"Border shadow/depth"},
1608 {
"Separator", &edit_theme.
separator,
"Horizontal/vertical separators"},
1610 {
"Separator Active", &edit_theme.
separator_active,
"Separator active/dragged state"},
1611 {
"Scrollbar BG", &edit_theme.
scrollbar_bg,
"Scrollbar track background"},
1612 {
"Scrollbar Grab", &edit_theme.
scrollbar_grab,
"Scrollbar handle"},
1615 {
"Resize Grip", &edit_theme.
resize_grip,
"Window resize grip"},
1620 for (
auto& [label, color_ptr, description] : border_control_colors) {
1621 ImGui::TableNextRow();
1622 ImGui::TableNextColumn();
1623 ImGui::AlignTextToFramePadding();
1624 ImGui::Text(
"%s:", label);
1626 ImGui::TableNextColumn();
1628 std::string
id = absl::StrFormat(
"##border_%s", label);
1629 if (ImGui::ColorEdit4(
id.c_str(), &color_vec.x)) {
1630 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1631 apply_live_preview();
1634 ImGui::TableNextColumn();
1635 ImGui::TextWrapped(
"%s", description);
1641 ImGui::EndTabItem();
1646 ImGui::Text(
"Enhanced semantic colors and editor-specific customization");
1650 if (ImGui::CollapsingHeader(
"Enhanced Semantic Colors", ImGuiTreeNodeFlags_DefaultOpen)) {
1651 if (ImGui::BeginTable(
"EnhancedSemanticTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1652 ImGui::TableSetupColumn(
"Color", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1653 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1654 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1655 ImGui::TableHeadersRow();
1657 auto enhanced_colors = std::vector<std::tuple<const char*, Color*, const char*>>{
1658 {
"Code Background", &edit_theme.
code_background,
"Code blocks background"},
1659 {
"Success Light", &edit_theme.
success_light,
"Light success variant"},
1660 {
"Warning Light", &edit_theme.
warning_light,
"Light warning variant"},
1661 {
"Error Light", &edit_theme.
error_light,
"Light error variant"},
1662 {
"Info Light", &edit_theme.
info_light,
"Light info variant"}
1665 for (
auto& [label, color_ptr, description] : enhanced_colors) {
1666 ImGui::TableNextRow();
1667 ImGui::TableNextColumn();
1668 ImGui::AlignTextToFramePadding();
1669 ImGui::Text(
"%s:", label);
1671 ImGui::TableNextColumn();
1673 std::string
id = absl::StrFormat(
"##enhanced_%s", label);
1674 if (ImGui::ColorEdit3(
id.c_str(), &color_vec.x)) {
1675 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1676 apply_live_preview();
1679 ImGui::TableNextColumn();
1680 ImGui::TextWrapped(
"%s", description);
1688 if (ImGui::CollapsingHeader(
"UI State Colors")) {
1689 if (ImGui::BeginTable(
"UIStateTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1690 ImGui::TableSetupColumn(
"Color", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1691 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1692 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1693 ImGui::TableHeadersRow();
1696 ImGui::TableNextRow();
1697 ImGui::TableNextColumn();
1698 ImGui::AlignTextToFramePadding();
1699 ImGui::Text(
"Active Selection:");
1700 ImGui::TableNextColumn();
1702 if (ImGui::ColorEdit4(
"##active_selection", &active_selection.x)) {
1703 edit_theme.
active_selection = {active_selection.x, active_selection.y, active_selection.z, active_selection.w};
1704 apply_live_preview();
1706 ImGui::TableNextColumn();
1707 ImGui::TextWrapped(
"Active/selected UI elements");
1709 ImGui::TableNextRow();
1710 ImGui::TableNextColumn();
1711 ImGui::AlignTextToFramePadding();
1712 ImGui::Text(
"Hover Highlight:");
1713 ImGui::TableNextColumn();
1715 if (ImGui::ColorEdit4(
"##hover_highlight", &hover_highlight.x)) {
1716 edit_theme.
hover_highlight = {hover_highlight.x, hover_highlight.y, hover_highlight.z, hover_highlight.w};
1717 apply_live_preview();
1719 ImGui::TableNextColumn();
1720 ImGui::TextWrapped(
"General hover state highlighting");
1722 ImGui::TableNextRow();
1723 ImGui::TableNextColumn();
1724 ImGui::AlignTextToFramePadding();
1725 ImGui::Text(
"Focus Border:");
1726 ImGui::TableNextColumn();
1728 if (ImGui::ColorEdit3(
"##focus_border", &focus_border.x)) {
1729 edit_theme.
focus_border = {focus_border.x, focus_border.y, focus_border.z, focus_border.w};
1730 apply_live_preview();
1732 ImGui::TableNextColumn();
1733 ImGui::TextWrapped(
"Border for focused input elements");
1735 ImGui::TableNextRow();
1736 ImGui::TableNextColumn();
1737 ImGui::AlignTextToFramePadding();
1738 ImGui::Text(
"Disabled Overlay:");
1739 ImGui::TableNextColumn();
1741 if (ImGui::ColorEdit4(
"##disabled_overlay", &disabled_overlay.x)) {
1742 edit_theme.
disabled_overlay = {disabled_overlay.x, disabled_overlay.y, disabled_overlay.z, disabled_overlay.w};
1743 apply_live_preview();
1745 ImGui::TableNextColumn();
1746 ImGui::TextWrapped(
"Semi-transparent overlay for disabled elements");
1753 if (ImGui::CollapsingHeader(
"Editor-Specific Colors")) {
1754 if (ImGui::BeginTable(
"EditorColorsTable", 3, ImGuiTableFlags_SizingStretchProp)) {
1755 ImGui::TableSetupColumn(
"Color", ImGuiTableColumnFlags_WidthFixed, 120.0f);
1756 ImGui::TableSetupColumn(
"Picker", ImGuiTableColumnFlags_WidthStretch, 0.6f);
1757 ImGui::TableSetupColumn(
"Description", ImGuiTableColumnFlags_WidthStretch, 0.4f);
1758 ImGui::TableHeadersRow();
1760 auto editor_colors = std::vector<std::tuple<const char*, Color*, const char*, bool>>{
1761 {
"Editor Background", &edit_theme.
editor_background,
"Main editor canvas background",
false},
1762 {
"Editor Grid", &edit_theme.
editor_grid,
"Grid lines in map/graphics editors",
true},
1763 {
"Editor Cursor", &edit_theme.
editor_cursor,
"Cursor color in editors",
false},
1764 {
"Editor Selection", &edit_theme.
editor_selection,
"Selection highlight in editors",
true}
1767 for (
auto& [label, color_ptr, description, use_alpha] : editor_colors) {
1768 ImGui::TableNextRow();
1769 ImGui::TableNextColumn();
1770 ImGui::AlignTextToFramePadding();
1771 ImGui::Text(
"%s:", label);
1773 ImGui::TableNextColumn();
1775 std::string
id = absl::StrFormat(
"##editor_%s", label);
1776 if (use_alpha ? ImGui::ColorEdit4(
id.c_str(), &color_vec.x) : ImGui::ColorEdit3(
id.c_str(), &color_vec.x)) {
1777 *color_ptr = {color_vec.x, color_vec.y, color_vec.z, color_vec.w};
1778 apply_live_preview();
1781 ImGui::TableNextColumn();
1782 ImGui::TextWrapped(
"%s", description);
1789 ImGui::EndTabItem();
1797 if (ImGui::Button(
"Preview Theme")) {
1802 if (ImGui::Button(
"Reset to Current")) {
1807 theme_name[name_len] =
'\0';
1811 theme_description[desc_len] =
'\0';
1815 theme_author[author_len] =
'\0';
1818 if (theme_backup_made) {
1819 theme_backup_made =
false;
1825 if (ImGui::Button(
"Save Theme")) {
1826 edit_theme.
name = std::string(theme_name);
1827 edit_theme.
description = std::string(theme_description);
1828 edit_theme.
author = std::string(theme_author);
1835 theme_backup_made =
false;
1842 bool can_save_over = !current_file_path.empty();
1844 if (!can_save_over) {
1845 ImGui::BeginDisabled();
1848 if (ImGui::Button(
"Save Over Current")) {
1849 edit_theme.
name = std::string(theme_name);
1850 edit_theme.
description = std::string(theme_description);
1851 edit_theme.
author = std::string(theme_author);
1858 theme_backup_made =
false;
1860 LOG_ERROR(
"Theme Manager",
"Failed to save over current theme");
1864 if (!can_save_over) {
1865 ImGui::EndDisabled();
1868 if (ImGui::IsItemHovered() && can_save_over) {
1869 ImGui::BeginTooltip();
1870 ImGui::Text(
"Save over current theme file:");
1871 ImGui::Text(
"%s", current_file_path.c_str());
1872 ImGui::EndTooltip();
1873 }
else if (ImGui::IsItemHovered()) {
1874 ImGui::BeginTooltip();
1875 ImGui::Text(
"No current theme file to overwrite");
1876 ImGui::Text(
"Use 'Save to File...' to create a new theme file");
1877 ImGui::EndTooltip();
1881 if (ImGui::Button(
"Save to File...")) {
1882 edit_theme.
name = std::string(theme_name);
1883 edit_theme.
description = std::string(theme_description);
1884 edit_theme.
author = std::string(theme_author);
1887 std::string safe_name = edit_theme.
name.empty() ?
"custom_theme" : edit_theme.
name;
1890 if (!file_path.empty()) {
1892 if (file_path.find(
".theme") == std::string::npos) {
1893 file_path +=
".theme";
1902 LOG_ERROR(
"Theme Manager",
"Failed to save theme");
1907 if (ImGui::IsItemHovered()) {
1908 ImGui::BeginTooltip();
1909 ImGui::Text(
"Save theme to a .theme file");
1910 ImGui::Text(
"Saved themes can be shared and loaded later");
1911 ImGui::EndTooltip();