-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Enhance ANSI colors for progress ui #2368
Conversation
I think the problem with this is that it makes the colors absolute. So while these may look good for you, they might not when user is using a specific theme. For |
I'm fine using another SGR code like
Yes should be done upstream pretty much like go-ansi. |
Good point as well. It's still odd that (at least on macOS) the default "dark blue" is very hard to read and the "bright" blue may be a bit too bright 😞 |
1a807a2
to
29d9bfa
Compare
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.
LGTM
I'm not the biggest fan of cyan, but it's definitely more readable, and out of the available options (looking at the default colours on macOS), looks like a good choice (unless we want to remove color and go for "grey").
I think there's no "perfect" option here, so we'll have to leave it to the user to customise their colours further.
Leave it cyan for windows only? |
I think we can keep cyan global? I was also wondering if the screenshot in the README was using cyan because |
I think it may be equally bad on macOS (default config that is). I'd have to try on a fresh macOS profile (unless someone has one set up) |
No, this has never been cyan |
@AkihiroSuda @ktock thoughts? |
SGTM about cyan as it at least solves the problem of invisible in some terminals. |
I don't use a white / light background terminal myself; does "green" or "bright green" work better for those? (there was a ticket in the compose repository that mentions compose used "green" before the switch to using buildkit / buildx); docker/compose#8629 |
Not sure about green, for me this color indicates a successful/terminated state, not an ongoing one. |
It seems like some xterms allow getting the background color.
works in iTerm/Terminal for me. Does not work in vscode inline console. No idea about windows + others update: poc https://gist.github.com/tonistiigi/a0c094d9858912f58b295586e9ec61d1 . blocks on read in vscode atm |
same on |
if it doesn't work on windows and powershell doesn't have an alternative then I think trying to detect background is not worth it |
Found muesli/termenv lib which seems to detect dark background: https://gist.github.com/crazy-max/610dfd4d93a0c8d4c6d539a9f7e08a7a. Could be a candidate to replace aec (also handles |
We can shop around a bit to see what good modules exist. My (personal) take on those are that;
|
@crazy-max looks like for windows it just returns constant true? https://github.com/muesli/termenv/blob/feb87954c13cdde17d5c454b24580fa58df01311/termenv_windows.go#L14 For unix it seems to use same xterm method together with some env detection |
Yeah indeed just tested myself. Would need smth like that through Win32API to work for Windows on |
I think we can start by setting cyan only on windows (seems that it looks better on all defaults there). Then we can see if we can do something smarter for rest and only do cyan on dark background. |
Signed-off-by: CrazyMax <[email protected]>
29d9bfa
to
165e705
Compare
Done. |
package progressui | ||
|
||
import "github.com/morikuni/aec" | ||
|
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.
should these be a const
?
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.
arf, commented on the wrong line
Nice that it's fixed for Windows.
Is this tracked somewhere? The dark blue is still practically unreadable on a black terminal in Linux (e.g. rxvt-unicode). This seems to be a fairly new problem (last few months) - I don't recall it being dark blue last time I ran docker-compose (docker-archive/compose-cli#1947). Is there an environment variable or something I can set so I can actually see the output without losing all colour? |
Maybe don't use any colors at all? They don't add much anyway, and then it's perfectly readable in all terminals. |
relates to
Attempt to use ANSI colors suitable for most terms:
xterm
windows powershell
windows cmd
windows terminal
tabby
We could also use another SGR code for blue like cyan which seems ok across major terms:
There is also the dichromatic palette for color blind. I guess there is a lot of discussion around this topic, so feel free to give your opinion. And another topic around
NO_COLOR
that we can discuss in a follow-up.cc @thaJeztah
Signed-off-by: CrazyMax [email protected]