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

Fix colors in console reporter, resolves #298 #369

Merged
merged 1 commit into from
May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/Test/Tasty/Ingredients/ConsoleReporter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,9 @@ ok, fail, skipped, infoOk, infoFail :: (?colors :: Bool) => String -> IO ()
fail = output failFormat
ok = output okFormat
skipped = output skippedFormat
infoOk = output infoOkFormat
-- Just default foreground color for 'infoOk'; do not apply 'infoOkFormat',
-- because terminal's background could be white itself. See #298.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that is the usual problem with coloring output.

We have the same problem when considering coloring errors for Agda.

It would be great to have symbolic colors, that resolve to physical color according to some (standard or custom) coloring scheme, depending on the background color.
I haven't found any Haskell solution to that problem yet (that at least works well on modern terminals).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not aware of any fundamental solution. Other colors used by tasty are less problematic: it's highly unlikely that someone has a terminal with red or green background; it's only infoOkFormat who poses an issue.

infoOk = putStr
infoFail = output infoFailFormat

output
Expand Down