mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-30 12:41:06 +01:00 
			
		
		
		
	Tables: Moved border colors to the Style (maybe temporarily?) instead of hardcoding them.
This commit is contained in:
		| @@ -2550,6 +2550,8 @@ const char* ImGui::GetStyleColorName(ImGuiCol idx) | |||||||
|     case ImGuiCol_PlotHistogram: return "PlotHistogram"; |     case ImGuiCol_PlotHistogram: return "PlotHistogram"; | ||||||
|     case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered"; |     case ImGuiCol_PlotHistogramHovered: return "PlotHistogramHovered"; | ||||||
|     case ImGuiCol_TableHeaderBg: return "TableHeaderBg"; |     case ImGuiCol_TableHeaderBg: return "TableHeaderBg"; | ||||||
|  |     case ImGuiCol_TableBorderStrong: return "TableBorderStrong"; | ||||||
|  |     case ImGuiCol_TableBorderLight: return "TableBorderLight"; | ||||||
|     case ImGuiCol_TableRowBg: return "TableRowBg"; |     case ImGuiCol_TableRowBg: return "TableRowBg"; | ||||||
|     case ImGuiCol_TableRowBgAlt: return "TableRowBgAlt"; |     case ImGuiCol_TableRowBgAlt: return "TableRowBgAlt"; | ||||||
|     case ImGuiCol_TextSelectedBg: return "TextSelectedBg"; |     case ImGuiCol_TextSelectedBg: return "TextSelectedBg"; | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								imgui.h
									
									
									
									
									
								
							| @@ -1324,6 +1324,8 @@ enum ImGuiCol_ | |||||||
|     ImGuiCol_PlotHistogram, |     ImGuiCol_PlotHistogram, | ||||||
|     ImGuiCol_PlotHistogramHovered, |     ImGuiCol_PlotHistogramHovered, | ||||||
|     ImGuiCol_TableHeaderBg,         // Table header background |     ImGuiCol_TableHeaderBg,         // Table header background | ||||||
|  |     ImGuiCol_TableBorderStrong,     // Table outer and header borders (prefer using Alpha=1.0 here) | ||||||
|  |     ImGuiCol_TableBorderLight,      // Table inner borders (prefer using Alpha=1.0 here) | ||||||
|     ImGuiCol_TableRowBg,            // Table row background (even rows) |     ImGuiCol_TableRowBg,            // Table row background (even rows) | ||||||
|     ImGuiCol_TableRowBgAlt,         // Table row background (odd rows) |     ImGuiCol_TableRowBgAlt,         // Table row background (odd rows) | ||||||
|     ImGuiCol_TextSelectedBg, |     ImGuiCol_TextSelectedBg, | ||||||
|   | |||||||
| @@ -3315,6 +3315,8 @@ static void ShowDemoWindowTables() | |||||||
|     // There are however a few settings that a shared and part of the ImGuiStyle structure: |     // There are however a few settings that a shared and part of the ImGuiStyle structure: | ||||||
|     //   style.CellPadding                          // Padding within each cell |     //   style.CellPadding                          // Padding within each cell | ||||||
|     //   style.Colors[ImGuiCol_TableHeaderBg]       // Table header background |     //   style.Colors[ImGuiCol_TableHeaderBg]       // Table header background | ||||||
|  |     //   style.Colors[ImGuiCol_TableBorderStrong]   // Table outer and header borders | ||||||
|  |     //   style.Colors[ImGuiCol_TableBorderLight]    // Table inner borders | ||||||
|     //   style.Colors[ImGuiCol_TableRowBg]          // Table row background when ImGuiTableFlags_RowBg is enabled (even rows) |     //   style.Colors[ImGuiCol_TableRowBg]          // Table row background when ImGuiTableFlags_RowBg is enabled (even rows) | ||||||
|     //   style.Colors[ImGuiCol_TableRowBgAlt]       // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows) |     //   style.Colors[ImGuiCol_TableRowBgAlt]       // Table row background when ImGuiTableFlags_RowBg is enabled (odds rows) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -223,6 +223,8 @@ void ImGui::StyleColorsDark(ImGuiStyle* dst) | |||||||
|     colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |     colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); | ||||||
|     colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); |     colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); | ||||||
|     colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.19f, 0.19f, 0.20f, 1.00f); |     colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.19f, 0.19f, 0.20f, 1.00f); | ||||||
|  |     colors[ImGuiCol_TableBorderStrong]      = ImVec4(0.31f, 0.31f, 0.35f, 1.00f);   // Prefer using Alpha=1.0 here | ||||||
|  |     colors[ImGuiCol_TableBorderLight]       = ImVec4(0.23f, 0.23f, 0.25f, 1.00f);   // Prefer using Alpha=1.0 here | ||||||
|     colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |     colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); | ||||||
|     colors[ImGuiCol_TableRowBgAlt]          = ImVec4(1.00f, 1.00f, 1.00f, 0.07f); |     colors[ImGuiCol_TableRowBgAlt]          = ImVec4(1.00f, 1.00f, 1.00f, 0.07f); | ||||||
|     colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); |     colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); | ||||||
| @@ -281,6 +283,8 @@ void ImGui::StyleColorsClassic(ImGuiStyle* dst) | |||||||
|     colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |     colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); | ||||||
|     colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); |     colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.60f, 0.00f, 1.00f); | ||||||
|     colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.27f, 0.27f, 0.38f, 1.00f); |     colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.27f, 0.27f, 0.38f, 1.00f); | ||||||
|  |     colors[ImGuiCol_TableBorderStrong]      = ImVec4(0.31f, 0.31f, 0.45f, 1.00f);   // Prefer using Alpha=1.0 here | ||||||
|  |     colors[ImGuiCol_TableBorderLight]       = ImVec4(0.26f, 0.26f, 0.28f, 1.00f);   // Prefer using Alpha=1.0 here | ||||||
|     colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |     colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); | ||||||
|     colors[ImGuiCol_TableRowBgAlt]          = ImVec4(1.00f, 1.00f, 1.00f, 0.07f); |     colors[ImGuiCol_TableRowBgAlt]          = ImVec4(1.00f, 1.00f, 1.00f, 0.07f); | ||||||
|     colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.00f, 0.00f, 1.00f, 0.35f); |     colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.00f, 0.00f, 1.00f, 0.35f); | ||||||
| @@ -340,6 +344,8 @@ void ImGui::StyleColorsLight(ImGuiStyle* dst) | |||||||
|     colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); |     colors[ImGuiCol_PlotHistogram]          = ImVec4(0.90f, 0.70f, 0.00f, 1.00f); | ||||||
|     colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.45f, 0.00f, 1.00f); |     colors[ImGuiCol_PlotHistogramHovered]   = ImVec4(1.00f, 0.45f, 0.00f, 1.00f); | ||||||
|     colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.78f, 0.87f, 0.98f, 1.00f); |     colors[ImGuiCol_TableHeaderBg]          = ImVec4(0.78f, 0.87f, 0.98f, 1.00f); | ||||||
|  |     colors[ImGuiCol_TableBorderStrong]      = ImVec4(0.57f, 0.57f, 0.64f, 1.00f);   // Prefer using Alpha=1.0 here | ||||||
|  |     colors[ImGuiCol_TableBorderLight]       = ImVec4(0.68f, 0.68f, 0.74f, 1.00f);   // Prefer using Alpha=1.0 here | ||||||
|     colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); |     colors[ImGuiCol_TableRowBg]             = ImVec4(0.00f, 0.00f, 0.00f, 0.00f); | ||||||
|     colors[ImGuiCol_TableRowBgAlt]          = ImVec4(0.30f, 0.30f, 0.30f, 0.07f); |     colors[ImGuiCol_TableRowBgAlt]          = ImVec4(0.30f, 0.30f, 0.30f, 0.07f); | ||||||
|     colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); |     colors[ImGuiCol_TextSelectedBg]         = ImVec4(0.26f, 0.59f, 0.98f, 0.35f); | ||||||
|   | |||||||
| @@ -267,13 +267,9 @@ bool    ImGui::BeginTableEx(const char* name, ImGuiID id, int columns_count, ImG | |||||||
|     table->HoveredColumnBorder = -1; |     table->HoveredColumnBorder = -1; | ||||||
|     table->RightMostActiveColumn = -1; |     table->RightMostActiveColumn = -1; | ||||||
|  |  | ||||||
|     // FIXME-TABLE FIXME-STYLE: Using opaque colors facilitate overlapping elements of the grid |     // Using opaque colors facilitate overlapping elements of the grid | ||||||
|     //table->BorderOuterColor = GetColorU32(ImGuiCol_Separator, 1.00f); |     table->BorderColorStrong = GetColorU32(ImGuiCol_TableBorderStrong); | ||||||
|     //table->BorderInnerColor = GetColorU32(ImGuiCol_Separator, 0.60f); |     table->BorderColorLight = GetColorU32(ImGuiCol_TableBorderLight); | ||||||
|     table->BorderColorStrong = GetColorU32(ImVec4(0.31f, 0.31f, 0.35f, 1.00f)); |  | ||||||
|     table->BorderColorLight = GetColorU32(ImVec4(0.23f, 0.23f, 0.25f, 1.00f)); |  | ||||||
|     //table->BorderOuterColor = IM_COL32(255, 0, 0, 255); |  | ||||||
|     //table->BorderInnerColor = IM_COL32(255, 255, 0, 255); |  | ||||||
|     table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f); |     table->BorderX1 = table->InnerClipRect.Min.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : -1.0f); | ||||||
|     table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f); |     table->BorderX2 = table->InnerClipRect.Max.x;// +((table->Flags & ImGuiTableFlags_BordersOuter) ? 0.0f : +1.0f); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user