overloads to support colorizing compiled format strings #4166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a new header
compile-color.h
with overloads offormat
,format_to
, andprint
to support passing in atext_style
together with a compiled format string.I did a bit of refactoring in
color.h
to support this via a newdetail::apply_style()
function because otherwise it would need a bunch of copy-pasting into the new header.It's generally great that fmt splits functionality across headers so you only pay for what you use. But here it's maybe unfortunate because you can include both
color.h
andcompile.h
and still be unable to colorize compiled format strings withcompile-color.h
.I had the idea of in e.g.
color.h
doing something likeand likewise in
compile.h
with#ifdef FMT_COLOR_H
but want to see if you have other/better ideas first or maybe just want to leave it as-is.Best, Moshe