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

Add concolor integration feature #58

Merged
merged 1 commit into from
Jan 15, 2023
Merged

Add concolor integration feature #58

merged 1 commit into from
Jan 15, 2023

Conversation

rumpuslabs
Copy link
Contributor

I started writing my own trait to wrap ariadne::Fmt to turn coloring on and off using concolor and then thought, why not push it upstream? I've made it an optional feature for backwards compatibility.

For the purposes of concolor's interactive terminal detection I've assumed that existing projects are writing to stderr but if they're not, they can switch to stdout by doing use ariadne::StdoutFmt instead of use ariadne::Fmt.

@zesterer
Copy link
Owner

zesterer commented Jan 9, 2023

Thanks! Does this mean that colour escape codes in the output won't be present if Write-ing to something like String?

@rumpuslabs
Copy link
Contributor Author

No, they will be present if Write-ing to a String, the same as they are now. If feature = "concolor", then ariadne::Fmt will assume (for the purposes of concolor's interactive terminal detection) that the String will eventually be written to stderr. If that assumption is incorrect, the user can use ariadne::StdoutFmt instead to get the opposite assumption. If both stdout and stderr are interactive terminals (or concolor has not(feature = "interactive")), then it makes no difference.

README.md Show resolved Hide resolved
@zesterer
Copy link
Owner

Thanks!

@zesterer zesterer merged commit 06b1748 into zesterer:main Jan 15, 2023
@rumpuslabs rumpuslabs deleted the concolor-integration branch January 16, 2023 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants