Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font texture styling - demo window and metric/debug #6129

Closed
wants to merge 2 commits into from

Conversation

nahkhiir
Copy link
Contributor

When using the Light style, the font texture displayed in the demo window (Widgets/Images) and the Metrics/Debug window is white on a light background and nearly unreadable (especially the magnified part under the mouse cursor)

font-texture-white-tint

metric-debug-white-tint

This is caused by a fixed white tint being applied to the font texture image which is fine for the Dark and Classic styles but is not suitable for the Light style.

ImVec4 tint_col = ImVec4(1.0f, 1.0f, 1.0f, 1.0f);

Changing the tint_col to use the styles text colour fixes the image display for the Light style and leaves the Dark and Classic styles unchanged as their font colour is light

ImVec4 tint_col = ImGui::GetStyleColorVec4(ImGuiCol_Text);

Result with fixed applied

font-texture-style-tint

metric-debug-style-tint

Dark style unaffected - before -

dark-style-white-tint

After -

dark-style-use-style-tint

@ocornut
Copy link
Owner

ocornut commented Jan 31, 2023

Hello,

Thanks for the PR.
Unfortunately the atlas can also contains RGBA contents (e.g. #3369 or custom glyph/icons added by application) so tinting is not always appropriate.

I've made this optional in ShowFontAtlas() with a checkbox: dd21cab and haven't touched the demo section because of that.
Thanks!

EDIT Also also the checkbox in Demo, in 2efebe3

@ocornut ocornut closed this Jan 31, 2023
@nahkhiir nahkhiir deleted the demo-font-texture-styling branch January 31, 2023 20:22
kjblanchard pushed a commit to kjblanchard/imgui that referenced this pull request May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants