-
Notifications
You must be signed in to change notification settings - Fork 841
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
Suggestion: Make Stack.PrettyPrint's styles background agnostic #4183
Comments
Fix #4183 Make PrettyPrint styles background-agnostic
The problem is that text becomes harder to read on terminals with white background. So, unless we can find a solution which detects the background before determining what color to use, we will have to also set background color. |
I agree that it's not pretty. Indeed it was a solution to text not being visible on light backgrounds - #4047 . An alternative may be to remove the background color and pick foreground colors that terminals are likely to display well. |
This comment is also in response to the comments of @mihaimaruseac on the pull request #4184. I acknowledge that if you do not force the background colour, there will always be some choice of terminal background colour that makes certain coloured foreground text 'invisible' - but perhaps stack does not need to accommodate all possible terminal background colours, only the most likely ones (including the extremes of dull black and vivid white)? On a white (vivid white) terminal do you think it is only the 'bold vivid white' text on white (used by For example 'vivid black' (black) or 'dull white' (which are both actually rendered as shades of grey on most terminals - see here) should have contrast on most terminal backgrounds. This is 'vivid black' for This is 'vivid black' on Terminal's 'Novel' theme: Alternatively (skipping shades of green and red as having special meaning or colours where the unused dull version is not particularly distinct from the vivid one), 'dull magenta' is currently not used by any style. If that is an acceptable fix, I'll propose another pull request, accordingly. |
Also changes `styleFile` to `black` (vivid black) from `bold . white`.
I tend to agree with this. |
Yep, I agree with removing the background colors that I added, and instead choosing different foreground colors. Glad you're adjusting these details! |
In order to ensure sufficient contrast on both black (dull black) and white (vivid white) terminals, also changes foreground text `bold . white` to `dullcyan` (affecting `styleFile` and `styleUrl`) and `yellow` to `dullyellow` (affecting `styleWarning` and `styleCurrent`). `dullcyan` is used in preference to `black` (vivid black) because the latter is problematic with the solarised dark theme. See also issue commercialhaskell#4047 and (reverted) commercialhaskell#4814.
I have done some further reading around and experimenting. To avoid the reported 'vivid yellow' on 'vivid white' contrast problem (#4047), I suggest that 'dull yellow' substitute for 'vivid yellow'. I do not use it myself, but I understand that 'solarized dark' is a very popular theme on a number of platforms and is, for example, accommodated by the (recent) Windows console Here are some results: The (new) Windows default console theme (known as 'campbell') (this is actually a screen shot of macOS Terminal.app; I have reproduced the Windows default there to ease experimentation): The 'Basic' Terminal.app theme (vivid white): The 'Solarized Dark' theme (note that stack's choice of 'vivid green' is not distinctive in this theme - however 'dull green' would be; I am going to propose a separate 'issue' to more fully address that sort of issue and the 'bigger picture' of colour choice for stack users): Finally (for consistency with my earlier comments), the 'Novel' Terminal.app theme: If this is acceptable, I will propose the corresponding pull request. |
This looks good to me |
In order to ensure sufficient contrast on both black (dull black) and white (vivid white) terminals, also changes foreground text `bold . white` to `dullcyan` (affecting `styleFile` and `styleUrl`) and `yellow` to `dullyellow` (affecting `styleWarning` and `styleCurrent`). `dullcyan` is used in preference to `black` (vivid black) because the latter is problematic with the solarised dark theme. See also issue commercialhaskell#4047 and (reverted) commercialhaskell#4814.
Fix #4183 Make PrettyPrint styles background-agnostic
Should the styles set in module
Stack.PrettyPrint
force the background to be black ('dull' black)? For example (line 181)styleFile = bold . white . ondullblack
. Beauty is in the eye of the beholder, but it seems to me that, for people using terminal themes with coloured backgrounds, the result is not pretty. For example, on a Mac Terminal with theme 'Novel':I suggest it would be better to be agnostic as to background and have (for example):
styleFile = bold . white
.This is on
stack --version
Version 1.8.0, Git revision 94d302c40d3d08dcaa0213f3f1ffdc1384842714 (6077 commits) x86_64 hpack-0.29.0
(given #4139).The text was updated successfully, but these errors were encountered: