imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Tooltips of disabled widgets are hard to read because of transparent background

Open DanielGibson opened this issue 1 year ago • 8 comments
trafficstars

Version/Branch of Dear ImGui:

Version 1.90.7

Back-ends:

imgui_impl_sdl2.cpp + imgui_impl_opengl2.cpp (probably all)

Compiler, OS:

Linux + GCC 11.4 (probably all)

Full config/build information:

No response

Details:

Widgets that are disabled (with ImGui::BeginDisabled()) can still show tooltips when hovered. This is great, for example to indicate why they're disabled. However, the background of those tooltips is very translucent, so whatever is under it becomes visible. Especially when there's text under the tooltip, it's hardly readable at all, see screenshot below.

I think that the tooltip background should always be opaque enough so its text can be easily read; probably it should look the same for enabled/disabled items, or otherwise maybe have a gray background (but still with high enough alpha value)

Screenshots/Video:

Tooltip of a disabled button: image

For comparison, tooltip when button is not disabled: image

(Please excuse the ugly handdrawn cursors, for some reason the real cursor wasn't on the screenshots)

Minimal, Complete and Verifiable Example code:

// Here's some code anyone can copy and paste to reproduce your issue
ImGui::Begin("Example Bug");

ImGui::BeginDisabled();
ImGui::Button("Disabled Button");
ImGui::SetItemTooltip("The tooltip text of the disabled button. This button has been disabled just for demonstration purposes.");
ImGui::EndDisabled();
ImGui::Text("Some text under the disabled button. Sometimes you just want some text under a button, you know?");
ImGui::Text("Could even be multiple lines of text! There's so much text in the world, you wouldn't believe it!");
ImGui::SeparatorText("Or even a Separator with text!");

ImGui::End();

DanielGibson avatar May 30 '24 22:05 DanielGibson