akinomyoga / blesh-contrib

Source of settings for Bash Line Editor https://github.com/akinomyoga/ble.sh (for ble-0.4+)
BSD 3-Clause "New" or "Revised" License
37 stars 11 forks source link

Colors in contrib/github265.... #24

Closed linwaytin closed 2 months ago

linwaytin commented 2 months ago

Hi, this issue is about the question I asked in https://github.com/akinomyoga/ble.sh/issues/265. Thanks a lot for the solution you provided. I still use it.

Lately I got a problem. Sometimes I have a terminal with a light background color like white. In this case, the foreground colors should not be light. Is it possible to detect the terminal's background color and change the foreground colors used in the gradient PS1?

Thank you.

akinomyoga commented 2 months ago
$ declare -p TERM COLORFGRG _ble_term_TERM    # in light-background terminal

$ declare -p TERM COLORFGRG _ble_term_TERM    # in dark-background terminal

Here are rough explanations of possible solutions depending on the result of the above command:

References:

linwaytin commented 2 months ago

A1: For light background (emacs-vterm)

declare -x TERM="xterm-256color"
bash: declare: COLORFGRG: not found
declare -a _ble_term_TERM=([0]="xterm:100")

For dark background (xterm)

declare -x TERM="xterm-256color"
bash: declare: COLORFGRG: not found
declare -a _ble_term_TERM=([0]="xterm:393")

But I think your last suggestion is the best solution. Setting up an env variable to determine if it's light background or not is the simplest way.

linwaytin commented 2 months ago

Another related issue for light background is the selection of suggestions. In dark background, the selected item has inverted color. image But for light background, nothing happens and I cannot know which one is the current selection. image

Do you have any idea about this behavior?

Thank you.

EDIT: Please skip this post. I found the problem is from my config, which prevented vterm to invert colors, so it has nothing to do with ble.sh. My bad.

akinomyoga commented 2 months ago

EDIT:

OK, is there still anything that I can help with?

linwaytin commented 2 months ago

No, thanks a lot!