Skip to content
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

Remove zsh color for comments #211

Merged
merged 4 commits into from
Aug 17, 2023
Merged

Remove zsh color for comments #211

merged 4 commits into from
Aug 17, 2023

Conversation

gbe
Copy link
Contributor

@gbe gbe commented Aug 16, 2023

Description

Whenever I am in the middle of a command line and I find out that I am missing a piece, I like commenting the line, to easily come back to it later.
However, the way zsh currently behaves completely hides the command as it is basically black on black.

The image below shows how "This is a comment" is displayed (hint: it's written on the first line):

Exegol-comment hidden

This PR makes the same comment appear as follows:

Exegol-comment hidden-after

At least we can read something.

This PR is minor and is a customization I have in my-resources, I thought maybe it can be of interest of others.

PR is based on the branch 3.1.1.

@ShutdownRepo
Copy link
Member

Nice, could you maybe set the style to something grey and italic, or only grey ?
Also, you should take a look at the push-line ZLE command wich could make your process way easier, it's on Exegol already

@ShutdownRepo ShutdownRepo added enhancement New feature or request waiting for additional changes Further changes are requested labels Aug 16, 2023
@gbe
Copy link
Contributor Author

gbe commented Aug 17, 2023

Unfortunately, grey is not a supported color apparently. There are only 8 from what I understand: https://github.com/zsh-users/zsh/blob/master/Functions/Misc/colors
And italic was not supported by two different terminals.

When the attribute is none and the background is black (as in my example), the comment appears in white. Should the background be white, the comment turns black automatically. This is nice for crazy people with a white background ;)

However, if we set the color amongst the 8 possible ones, it seems the best ones are (in my opinion and in order of preference) :

  • cyan (preferred color):

Exegol-cyan

  • blue:

Exegol-blue

  • magenta:

Exegol-magenta

The others colors may be too much connotated as an error (red), a success (green), pown (yellow). Plus, these three catch too much the eye for a text that is only a comment, and by definition not important.

Aaah, taste and colors 😄

@ShutdownRepo ShutdownRepo removed the waiting for additional changes Further changes are requested label Aug 17, 2023
@ShutdownRepo
Copy link
Member

Alright, let's go with cyan then
The issue with white being that it's the default color, that it's used in regular commands, I'd like to have a different color for comments, since let's go with cyan

@gbe
Copy link
Contributor Author

gbe commented Aug 17, 2023

@ShutdownRepo Thanks for your return. This is done.

@ShutdownRepo
Copy link
Member

@gbe I was able to have grey comments with the following line, I'm editing your PR now

ZSH_HIGHLIGHT_STYLES[comment]='fg=#888888'

Let's have it that way so that the format is similar to what's been set on ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE, the color is pretty neutral while not being too dark.
And if users want to have a custom color, it's possible through my-resources (docs)

Setting the comment color to grey
@gbe
Copy link
Contributor Author

gbe commented Aug 17, 2023

Perfect

@ShutdownRepo
Copy link
Member

Tests passed, merging now

@ShutdownRepo ShutdownRepo merged commit 51dfc73 into ThePorgs:3.1.1 Aug 17, 2023
17 checks passed
@ShutdownRepo ShutdownRepo mentioned this pull request Aug 17, 2023
@gbe gbe deleted the zsh-comment branch September 29, 2023 13:03
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