Skip to content

Don't set the prompt color when running in light terminal theme #485

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

Closed
afbjorklund opened this issue Dec 16, 2021 · 14 comments · Fixed by #1893
Closed

Don't set the prompt color when running in light terminal theme #485

afbjorklund opened this issue Dec 16, 2021 · 14 comments · Fixed by #1893

Comments

@afbjorklund
Copy link
Member

afbjorklund commented Dec 16, 2021

As noted in #427 (comment), there are some usability issues with lime-on-white.

lima-light

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


@afbjorklund
Copy link
Member Author

afbjorklund commented Mar 27, 2022

With the new (cyan) lima color, this is not needed anymore. It looks OK enough in both modes:

lima-color-tango-dark

lima-color-tango-light

PS1='\[\033[38;2;0;191;140m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

@cwegener
Copy link
Contributor

cwegener commented Oct 5, 2023

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.

@afbjorklund
Copy link
Member Author

Thank you for the feedback, and this was when running in a "light" theme with a white or light yellow/gray background?

@cwegener
Copy link
Contributor

cwegener commented Oct 6, 2023

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.

@afbjorklund
Copy link
Member Author

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...

ubuntu-lima-color-prompt

The main goal was to separate the two prompts (beyond the host).

@afbjorklund
Copy link
Member Author

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...

lima-base16-classic-dark

lima-base16-classic-light

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...

lima-prompt i.e. PS1="[LIMA] $PS1"

@cwegener
Copy link
Contributor

cwegener commented Oct 6, 2023

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)

@cwegener
Copy link
Contributor

cwegener commented Oct 6, 2023

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.

@cwegener
Copy link
Contributor

cwegener commented Oct 6, 2023

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

ubuntushell.webm

@cwegener
Copy link
Contributor

cwegener commented Oct 6, 2023

#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.

@afbjorklund
Copy link
Member Author

The new "dark cyan" color would have worked with the new color scheme, but I think I will drop the "bright green" color.

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

lima-alpine-color-prompt

And otherwise it was only the "default" instance that got the override, if you started "ubuntu" it was still green.

@cwegener
Copy link
Contributor

cwegener commented Oct 7, 2023

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?

@afbjorklund
Copy link
Member Author

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" (#427 (comment))

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:

I opened a new issue for the discussion of the lima color prompt:

@cwegener
Copy link
Contributor

cwegener commented Oct 8, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants