lima
lima copied to clipboard
Don't set the prompt color when running in light terminal theme
As noted in https://github.com/lima-vm/lima/issues/427#issuecomment-979440137, there are some usability issues with lime-on-white.

It should also be possible to opt out of it (color), even for the default instance.
Use a better library, than the proposed port:
https://github.com/muesli/termenv
- Issue #427
With the new (cyan) lima color, this is not needed anymore. It looks OK enough in both modes:


PS1='\[\033[38;2;0;191;140m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
I haven't had any issues with colors from limactl output. And the colors for the interactive prompt look good to me too.
I am using base16-shell for terminal colors and most importantly all the lima colors honor the colors from base16-shell.
I spot checked a few of the base16-shell color themes on a couple of terminals on Linux and the all have readable text for both limactl output and the interactive prompts.
Thank you for the feedback, and this was when running in a "light" theme with a white or light yellow/gray background?
I actually checked all the base16 themes and as expected, color text is always perfectly readable. Which is actually a property of base16-shell
I think a better measure would be to test with the default color settings of some major macOS and Linux desktop terminal emulators.
I don't really know what "base16-shell" is, but I guess it is https://github.com/chriskempson/base16-shell ?
As mentioned in the other older issues, I only tested with the Ubuntu terminal so don't know about others...
The main goal was to separate the two prompts (beyond the host).
I actually checked all the base16 themes and as expected, color text is always perfectly readable.
I tried out a few themes, and I am not sure I agree...
I would say that the default prompt has some issues?
So we should either change the color, or revert to the original. Perhaps just use something else...
i.e.
PS1="[LIMA] $PS1"
I tried out a few themes, and I am not sure I agree...
Oh! I was testing a different prompt! I tested the limactl interactive prompts (i.e. limactl start)
I didn't actually bother about the shell prompts inside the VM. (My personal use of lima shell is non-interactive. i..e I don't enter an interactive lima shell very often)
So we should either change the color, or revert to the original. Perhaps just use something else...
That's exactly what I'm thinking. [LIMA] as a prefix in front of the lima shell prompt string should make it clear for anyone who may not see the lima-<name> hostname in the prompt.
Cycling through all the base16 color schemes. The light green color is indeed bad. It's not visible against a light background. Something is wrong there with the username and hostname part of the shell prompt. I do remember this light green being a default Ubuntu shell prompt color in the past. I haven't used an Ubuntu desktop in a while. So I'm not sure what the default shell prompt colors are today.
I have also checked the Ubuntu $LS_COLORS and they're all fine
#433
Ah. I see now. The change of the Ubuntu prompt was deliberate ... Hmm. Yeah. Not sure about that. Seems like opening up a can of worms.
The new "dark cyan" color would have worked with the new color scheme, but I think I will drop the "bright green" color.
-
https://github.com/lima-vm/lima/issues/268#issuecomment-1069351680
-
#00bf8c"lima" -
#BFFF00"lime"
It required extra code to export the COLORTERM and TERMTHEME variables, and I am not sure if it was all worth it...
#486
COLORTERM=truecolor
TERMTHEME=Dark
Then it will fall back to using the usual TERM=xterm-256color (and NO_COLOR if desired) environment variables.
The Alpine image didn't use any color prompt (at all) anyway, unless you enable /etc/profile.d/color_prompt.sh
And otherwise it was only the "default" instance that got the override, if you started "ubuntu" it was still green.
The Alpine image didn't use any color prompt
Yeah. I was wondering about the original implementation of the color change.
The way I understand it, the change of the Ubuntu bash prompt color was specifically for one single use case:
- Running Ubuntu Lima VM on a Ubuntu Host OS
I'm not sure how widespread this particular Ubuntu-on-Ubuntu use case even is? Obviously you are using Ubuntu-on-Ubuntu yourself, so it's a pretty important use case.
The part that I still don't understand is why color is required as a concept at all.
If we take just the title of the of the original issue #427
Make the shell prompt $PS1 distinguishable from the host shell
Then I think there is probably nothing that would need to be done, because in most cases, the hostname of the Lima VM will already be part of the PS1 shell prompt.
And if I understand it correctly, the hostname always begins with lima- ???
So, wouldn't the shell prompt already be distinguishable by default?
I'm not sure how widespread this particular Ubuntu-on-Ubuntu use case even is? Obviously you are using Ubuntu-on-Ubuntu yourself, so it's a pretty important use case.
I think it is a good thing that Lima allows running also on developer (Linux) machines, but in this case it is only relevant in the context of the default terminal colors on the host.
Other projects like Docker Machine or Podman Machine took years, before they "allow" running it on something other than Mac and Windows? Even if you actually wanted to, that is.
In the original implementation, I was not using the default theme on my Ubuntu machine anyway (mostly used that for screenshots), so it already looked different from the host terminal.
The part that I still don't understand is why color is required as a concept at all.
It is not required, it was one way of making the lima shell special:
"Maybe we should change the color of $PS1 by default" (https://github.com/lima-vm/lima/issues/427#issue-1060070781)
So that's what I did, and now "ubuntu-lima" (i.e. "default") is different.
It seemed like a good idea at the time, but as said there are other options...
The prompt is no longer "bright green", so I think this issue is closed:
- #485
I opened a new issue for the discussion of the lima color prompt:
- #1892
I think it is a good thing that Lima allows running also on developer (Linux) machines, but in this case it is only relevant in the context of the default terminal colors on the host.
100% agreed.
What I was not sure about was the current "market share" of Ubuntu amongst developer desktops, compared to e.g. popOS, Fedora, Manjaro, etc...
From my highly anecdotal experience, Ubuntu actually DOES still hold the majority of the "market share" in the Linux Developer space.