mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Demo: Console: More friendly to text color changes.
This commit is contained in:
parent
e916310b2e
commit
9511f22e8b
@ -2616,12 +2616,13 @@ struct ExampleAppConsole
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
|
||||
if (copy_to_clipboard)
|
||||
ImGui::LogToClipboard();
|
||||
ImVec4 col_default_text = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
{
|
||||
const char* item = Items[i];
|
||||
if (!filter.PassFilter(item))
|
||||
continue;
|
||||
ImVec4 col = ImVec4(1.0f,1.0f,1.0f,1.0f); // A better implementation may store a type per-item. For the sample let's just parse the text.
|
||||
ImVec4 col = col_default_text;
|
||||
if (strstr(item, "[error]")) col = ImColor(1.0f,0.4f,0.4f,1.0f);
|
||||
else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, col);
|
||||
|
Loading…
Reference in New Issue
Block a user