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

Changing default colors for AUTO_MENU_LIST #850

Closed
vszitkey opened this issue Jul 25, 2023 · 4 comments
Closed

Changing default colors for AUTO_MENU_LIST #850

vszitkey opened this issue Jul 25, 2023 · 4 comments
Labels

Comments

@vszitkey
Copy link

Hi, I would like to use AUTO_MENU_LIST option, but not with the default colors.

image

Way to do this was mentioned in #582. But I no longer see COMPLETION_COLOR_STARTING, COMPLETION_COLOR_DESCRIPTION and COMPLETION_LIST_BACKGROUND_COLOR variables, so I tried to change them with following attempts, but without any success.

LineReader reader = LineReaderBuilder.builder()
.terminal(this.terminal)
.option(LineReader.Option.AUTO_MENU_LIST, true)
.variable(COMPLETION_STYLE_LIST_BACKGROUND, Colors.rgbColor("white"))
.variable(COMPLETION_STYLE_BACKGROUND, Colors.rgbColor("white"))
.completer(completer)
.build();

Most likely I am missing something trivial, any advice? Thanks

@mattirn
Copy link
Collaborator

mattirn commented Jul 25, 2023

@vszitkey , the LineReader variables that control menu list styles have a prefix COMPLETION_STYLE_LIST_ as an example COMPLETION_STYLE_LIST_STARTING, COMPLETION_STYLE_LIST_DESCRIPTION , COMPLETION_STYLE_LIST_BACKGROUND etc, see more details in #617.

@vszitkey
Copy link
Author

vszitkey commented Aug 1, 2023

Thanks for answer, I tried following ("white" was chosen so that I can notice the change):

LineReader reader = LineReaderBuilder.builder()
.terminal(this.terminal)
.option(LineReader.Option.AUTO_MENU_LIST, true)
.variable(COMPLETION_STYLE_LIST_BACKGROUND, Colors.rgbColor("white"))
.variable(COMPLETION_STYLE_LIST_DESCRIPTION, Colors.rgbColor("white"))
.variable(COMPLETION_STYLE_LIST_STARTING, Colors.rgbColor("white"))
.variable(COMPLETION_STYLE_LIST_SELECTION, Colors.rgbColor("white"))
.variable(COMPLETION_STYLE_LIST_GROUP, Colors.rgbColor("white"))
.completer(completer)
.build();

but colors remain the same as before.
What am I missing?

@mattirn
Copy link
Collaborator

mattirn commented Aug 1, 2023

You have to assign to the COMPLETION_STYLE_LIST_<name> variable a string style value that the StyleResolver is able to resolve.

The style value has the following syntax:

<style1>[,<style2>[,style3]...]

where in <stylei> you can define foreground/background color as

f|fg|foreground:<color>
b|bg|backgroung:<color>

where <color> can be defined as eight color name (white, black, blue, red, ...), 256 color name (~grey0, ~navyblue, ~darkblue, ~blue3, ...) or color index (0 - 255).

You can define also RGB colors as:

f-rgb|fg-rgb|foreground-rgb:<color>
b-rgb|bg-rgb|backgroung-rgb:<color>

where <color> is x<rgb>} or #<rgb> and <rgb> is a 24 bits hexadecimal color.

In addition to colors you can set also ansi styles by setting <stylei> values:

blink, bold, conceal, crossed-out, faint, hidden, inverse, inverse-neg, italic or underline.

See more details in the StyleResolver javadoc and StyleResolver.

@vszitkey
Copy link
Author

vszitkey commented Aug 3, 2023

Thank you very much @mattirn :)

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

No branches or pull requests

3 participants