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

Different color for font icon than text #4871

Open
dgregorius opened this issue Jan 6, 2022 · 1 comment
Open

Different color for font icon than text #4871

dgregorius opened this issue Jan 6, 2022 · 1 comment

Comments

@dgregorius
Copy link

dgregorius commented Jan 6, 2022

Version/Branch of Dear ImGui:

Version: 1.87 WIP
Branch: Docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_opengl3.cpp + imgui_impl_glfw3.cpp
Compiler: VS2022
Operating System: Windows 10 Pro

My Issue/Question:

I want to tint a font icon, but have a different color for the associate text. E.g. think of an

ImGui::TreeNode( "FOLDER_ICON" "Directory" );

I would like to tint the folder icon yellow or blue for the sake of argument while the text should be white. Is this possible yet?

@thedmd
Copy link
Contributor

thedmd commented Jan 6, 2022

Without modifying ImGui itself this is not possible.

There was an extension when text drawing routines received support for ANSI color codes, you can find it here: imGuiAnsiColor.hpp, originally code was linked in #902.

You can modify ImGui to use this text drawing routine and you achieve some form of what you need.
I don't see measurement functions patched, so this mean escape codes will be measured with text, which may or may not be a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants