Skip to content

Introduce JOLLY_COLOR_HOSTNAME #7

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

steelman
Copy link
Contributor

@steelman steelman commented Jan 7, 2025

It is now possible to configure colors of the hostname segment independently. Although it may seem contrary to the the spirit of the Jolly theme to limit distractions for the user, it may actually help users quickly distingush hosts they are working with.

If not set in a configuration file JOLLY_COLOR_HOSTNAME is initialized with the value of JOLLY_COLOR_LITE.

@nojhan
Copy link
Owner

nojhan commented Jan 7, 2025

Thanks for considering a pull request!

At first thoughts, it seems indeed to contradict the design principles. But I have several questions before understanding the underlying question.

It also may come against LP_ENABLE_SSH_COLOR (which is allowed by Jolly). One may also expect that the background color of the hostname segment should follow LP_ENABLE_SSH_COLOR (which currently changes the foreground color).

Emphasizing segments with different colors may also be considered useful for any segment, separately. But this seems a bit much to extend the feature this far.

I guess my questions would be: why is the hostname specifically interesting for you? And why change the multiplexer color with the same color as the hostname?

@nojhan nojhan self-assigned this Jan 7, 2025
@nojhan nojhan added the enhancement New feature or request label Jan 7, 2025
@steelman
Copy link
Contributor Author

steelman commented Jan 8, 2025

It also may come against LP_ENABLE_SSH_COLOR (which is allowed by Jolly).

Unlike setting the hostname colour set via LP_ENABLE_SSH_COLOR, JOLLY_COLOR_HOSTNAME

  • is deterministic, users can assign hosts their colours following patterns (location, function, organization etc.),
  • controls both foreground and background,
  • allows using full 256 colour palette (I know they aren't all distinguishable but its user's choice).

If JOLLY_COLOR_HOSTNAME is not set LP_ENABLE_SSH_COLOR still works fine.

One may also expect that the background color of the hostname segment should follow LP_ENABLE_SSH_COLOR (which currently changes the foreground color).

Indeed, the background seems like a better choice. Especially because dim yellow (no. 3) and to lesser extent dim cyan (no. 6) letters are nearly unreadable when combined JOLLY_COLOR_LITE used currently for the hostname segment. Grey letters on these background don't look good either, but at least the whole segment is distinguishable.

Emphasizing segments with different colors may also be considered useful for any segment, separately. But this seems a bit much to extend the feature this far.

Yes, this occurred to me too, after creating this patch. I guess it's not a bad idea to keep the default settings as they are now and give more control to users who may choose to highlight some segments of their choice.

I guess my questions would be: why is the hostname specifically interesting for you?

This isn't exactly my personal use case but a friend of mine, who works daily with multiple machines at a time uses colours in host prompts (not lp/jolly yet ;) to distinguish terminal windows.

And why change the multiplexer color with the same color as the hostname?

As far as I can tell the colour used in __jolly_activate_multiplexer() (to make appropriate separator) has been chosen to match the one used in the hostname segment. With JOLLY_COLOR_LITE left unchanged you get a seam between the separator indicating the presence of a multiplexer and the hostname segment. The same goes for the color in the filesystem segment.

jolly

@nojhan
Copy link
Owner

nojhan commented Jan 11, 2025

Those are sound arguments. It make me wonder if a refactoring that would handle cleanly the segment color problem would solve it while also making it easy to do the same for any segment. I guess different users may consider important different segments, and thus need to specifically highlight those.

As of now, Jolly has been implemented using the approach of the powerlevel theme provided by liquidprompt, but this required a lot of very ugly hacks, because powerlevel was considering a prompt built from left to right, which is not the case of Jolly. This is why we sometime have strange behaviors, like the one you're pointing out.

Would it also be possible to solve your friend's problem by changing the (two/four) colors of the whole prompt? What problem would that cause? (I'm thinking about that seeing your screenshot)

It is now possible to configure colors of the hostname segment independently.
Although it may seem contrary to the the spirit of the Jolly theme to limit
distractions for the user, it may actually help users quickly distingush
hosts they are working with.

If not set in a configuration file JOLLY_COLOR_HOSTNAME is initialized
with the value of JOLLY_COLOR_LITE.
@steelman steelman force-pushed the jolly-color-hostname branch from 1c702ec to 52dad2c Compare January 16, 2025 09:45
@steelman
Copy link
Contributor Author

Would it also be possible to solve your friend's problem by changing the (two/four) colors of the whole prompt? What problem would that cause? (I'm thinking about that seeing your screenshot)

As far as I can tell after playing with this for while myself, I'd say I wouldn't like my prompt to change that dramatically between hosts. A single segment is just enough for me. The color scheme on the screenshot is from my office (where I a few have different machines distinguished now by different hostname segment background), while at home I use the default grey prompt on black background.

Fun fact: an alternative way to change color palette of the whole prompt is to reconfigure the gray entries in the terminal palette with OSC 4 ; c ; spec as described here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants