-
Notifications
You must be signed in to change notification settings - Fork 186
ImGui C++ bindings for ANSI Escape Sequence-based text coloring #167
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
Conversation
Thanks. Could you take a look at builds failing on AppVeyor? |
AnsiFeed/AnsiTextColored.cpp
Outdated
|
||
std::string seq( &s[2], seqEnd ); | ||
std::string colorStr; | ||
for (const auto& el : jet::split(seq, ";")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI build is failing here on the const auto&
. This syntax is probably too new; it should be replaced with a less-modern substitute.
Otherwise, looks like there's some sort of deprecation thing going on with Sphinx? I can't make sense of the other errors. |
Doing this online, so no guarantees this fixes it immediately.
These changes might have fixed the tests-build on my computer. I'll get on to writing some tests soon. |
Sorry it took so long, when the pipelines finish I will release it as new version. I made slight changes to the file names to keep everything more consistent with existing code. |
I had to spend 6 hours on investigating CI issues. Seems like we're almost there. But in the meantime I've noticed that this relies on some ImGui internals that have some risk of being changed often. That's I will make a small change to expose it in extra submodule. This way users will be aware that this isn't something available out-of-the box in the base library. Does it sound reasonable? |
Sure, that sounds reasonable. I think the implementation I used (linked above) copied the internals of imgui's text() function, so while it should be rather straightforward to keep up to date, and the API should stay rock-solid, it needs to be maintained. |
Released as |
text_ansi()
andtext_ansi_colored()
are added. They have the exact same interface astext()
andtext_colored()
, with the exception of logic going on inside to find and react to ANSI escape sequences. I find this useful for displaying logged colored terminal output.colorama.Fore
colors should all work; noinit()
required.I do not know if adding ANSI escape sequences and using
text_ansi()
is computationally slower than a series oftext_colored()
calls. That would be interesting to figure out for use cases besides having ANSI codes already embedded in the input.C++ implementation from here: https://gist.github.com/ddovod/be210315f285becc6b0e455b775286e1
Sorry for no tests yet; I haven't been able to get the test build configuration correct yet.