Choosing colors for auto menu list completion

68 views
Skip to first unread message

Brad Wood

unread,
Dec 4, 2020, 3:43:07 PM12/4/20
to jline...@googlegroups.com
How can I change the colors used for the auto menu list completion?  The standard completion looks like this:

image.png

which is pleasant, but when I enable the AUTO_MENU_LIST option, the colors look like this:

image.png

which is, well... pink!

Is there a way to dial in another background color?

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 

Matti Rinta-Nikkola

unread,
Dec 9, 2020, 1:30:04 AM12/9/20
to jline-users
Menu colors can be customized using JLine variables COMPLETION_COLOR_STARTING, COMPLETION_COLOR_DESCRIPTION and COMPLETION_LIST_BACKGROUND_COLOR (256-color mode). E.g. change background color to grey set COMPLETION_LIST_BACKGROUND_COLOR=242.

Guillaume Nodet

unread,
Dec 9, 2020, 2:26:46 AM12/9/20
to jline...@googlegroups.com
And in case you want to specify bold or other non-color attributes, you can use COMPLETION_STYLE_(STARTING|DESCRIPTION|GROUP|SELECTION).  

Matti, btw I wonder why we don't have a COMPLETION_STYLE_BACKGROUND instead of the COMPLETION_LIST_BACKGROUND_COLOR which would be give slightly more freedom and be more inline with the other styles.

--
You received this message because you are subscribed to the Google Groups "jline-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jline-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jline-users/1848df6a-7f65-4790-b91f-8f6295a522d5n%40googlegroups.com.

Brad Wood

unread,
Dec 9, 2020, 11:21:04 AM12/9/20
to jline...@googlegroups.com
Thanks for the help guys, this works well.

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Brad Wood

unread,
Dec 11, 2020, 12:39:39 PM12/11/20
to jline...@googlegroups.com
Updating to Jline 3.1.8.0 has broken this.  I was specifically using the following variables in the 3.17 snapshot:

COMPLETION_LIST_BACKGROUND_COLOR
COMPLETION_COLOR_DESCRIPTION

Did the names change?  Where is the documentation of the current variable names I can use?

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Brad Wood

unread,
Dec 11, 2020, 12:47:48 PM12/11/20
to jline...@googlegroups.com
I see a commit yesterday went in and changed some of these variable names.


However, when I changed to using the variables like so:

// These color tweaks are to improve the default ugly "pink" color in the optional AUTO_MENU_LIST setting (activated below)
'#LineReaderClass.COMPLETION_STYLE_LIST_BACKGROUND#' : 12,
'#LineReaderClass.COMPLETION_STYLE_LIST_DESCRIPTION#' : 8

I now get dozens of warnings in the console when I hit tab:

Dec 11, 2020 11:43:37 AM org.jline.utils.StyleResolver applyNamed
WARNING: Unknown style: 12.0 
Dec 11, 2020 11:43:37 AM org.jline.utils.StyleResolver applyNamed
WARNING: Unknown style: 12.0
Dec 11, 2020 11:43:37 AM org.jline.utils.StyleResolver applyNamed
WARNING: Unknown style: 12.0
Dec 11, 2020 11:43:37 AM org.jline.utils.StyleResolver applyNamed
WARNING: Unknown style: 12.0 

So now I guess I have two questions.
  1. How do I use these new variables?
  2. Why are there warnings being output in the console when I don't have any logging configured other than whatever comes default in JLine.
Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Matti Rinta-Nikkola

unread,
Dec 11, 2020, 2:06:15 PM12/11/20
to jline-users
You can set foreground/background color using a style string '38;5;⟨n⟩'/'48;5;⟨n⟩' where <n> is the color number of 256-color table.

Matti

Brad Wood

unread,
Dec 11, 2020, 2:51:08 PM12/11/20
to jline...@googlegroups.com
Interesting.  After digging in the source code a bit, I had come up with this as an experiment:

'#LineReaderClass.COMPLETION_STYLE_LIST_BACKGROUND#' : 'bg:blue',
'#LineReaderClass.COMPLETION_STYLE_LIST_DESCRIPTION#' : 'fg:~grey'


Should I be using the syntax you showed, or is what I have above also acceptable?  it also seems a little redundant to need to specify "bg" for a setting that already has the word "background" in the name.  Is this really correct?  

That said, it also seems the commit yesterday did more than just change the names of the variables and the format they expect.  The menu list no longer behaves the same color-wise as it did in the previous snapshot build.  Now my background color isn't being applied to the description and the highlight color is different now as well (back to pink).

image.png

It would be nice to get a little better documentation and/or direction on what's changed between the code 2 days ago and the code today and how I'm expected to get the same behavior back that I had in Jline's 3.17 snapshots.  After all the testing this last week, I was hoping to make a release today, but this last minute change committed yesterday prior to the stable release has thrown a wrench in the gears.

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Brad Wood

unread,
Dec 11, 2020, 3:06:11 PM12/11/20
to jline...@googlegroups.com
One more question-- what is the purpose of the COMPLETION_STYLE_LIST_GROUP variable seeing as how the "list" style of completion does not obey groups (would be nice if it did!)

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Matti Rinta-Nikkola

unread,
Dec 11, 2020, 3:48:11 PM12/11/20
to jline-users
> Should I be using the syntax you showed, or is what I have above also acceptable?

Both are ok.

> The menu list no longer behaves the same color-wise as it did in the previous snapshot build.

That's true but the snapshot build was having limitations that were not acceptable.
You have take care to put correct background for description:

'#LineReaderClass.COMPLETION_STYLE_LIST_DESCRIPTION#' : 'fg:~grey,bg:blue'

Matti

Matti Rinta-Nikkola

unread,
Dec 11, 2020, 3:53:45 PM12/11/20
to jline-users

> One more question-- what is the purpose of the COMPLETION_STYLE_LIST_GROUP variable seeing as how the "list" style of completion does not obey groups (would be nice if it did!)

For now it is not used anywhere. If we but group names to the 'list' than it will be used for group name highlight.

Matti

Brad Wood

unread,
Dec 11, 2020, 3:56:36 PM12/11/20
to jline...@googlegroups.com
Thanks for the additional help.  I have settled on the following variables which seem to get me back where I was:

'#LineReaderClass.COMPLETION_STYLE_LIST_BACKGROUND#' : 'bg:~grey',
'#LineReaderClass.COMPLETION_STYLE_LIST_DESCRIPTION#' : 'fg:blue,bg:~grey',
'#LineReaderClass.COMPLETION_STYLE_LIST_STARTING#' : 'inverse,bg:~grey'

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 

Guillaume Nodet

unread,
Dec 11, 2020, 3:59:12 PM12/11/20
to jline...@googlegroups.com
You can also refer to other styles

'listBackground' : 'bg:~grey'
'#LineReaderClass.COMPLETION_STYLE_LIST_BACKGROUND#' : '.listBackground',
'#LineReaderClass.COMPLETION_STYLE_LIST_DESCRIPTION#' : 'fg:blue,.listBackground',
'#LineReaderClass.COMPLETION_STYLE_LIST_STARTING#' : 'inverse,.listBackground'

I'm writing the full BNF for the grammar right now ...

Guillaume Nodet

unread,
Dec 11, 2020, 4:26:15 PM12/11/20
to jline...@googlegroups.com
Here it is:

<style> ::= <spec> | <spec> ":-" <spec>
<spec> ::= <part> | <spec> "," <part>
<part> ::= <reference> | <color> | <ansi> | <named>
<reference> ::= "." <string>
<color> ::= <fg> | <bg> | <fgrgb> | <bgrgb>
<ansi> ::= <decimal> | <ansi> ";" <decimal>
<named> ::= "bold" | "faint" | "italic" | "underline" | "blink" | "inverse" | "inverse-neg" | "inverseneg" | "conceal" | "crossed-out" | "crossedout" | "hidden"
<fgprefix> ::= "f" | "fg" | "foreground"
<bgprefix> ::= "b" | "bg" | "background"
<fg> ::=  <fgprefix> ":" ( "default" | <color8> | <color16> | <color256> )
<bg> ::=  <bgprefix> ":" ( "default" | <color8> | <color16> | <color256> )
<fgrgb> ::= <fgprefix> "-rgb" ":" ( "default" | <color8> | <color16> | <color256> | <color24bit> )
<bgrgb> ::= <bgprefix> "-rgb" ":" ( "default" | <color8> | <color16> | <color256> | <color24bit> )
<color8> ::= "black" | "red" | "green" | "yellow" | "blue" | "magenta" | "cyan" | "white" | "k" | "r" | "g" | "y" | "b" | "m" | "c" | "w"
<color16> ::= ( "!" | "bright-" )? <color8>
<color256> ::= "~" <colorname>
<colorname> ::= "black" | "maroon" | "green" | "olive" | "navy" | "purple" | "teal" | "silver" | "grey" | "red" | "lime" | "yellow" | "blue" | "fuchsia" | "aqua" | "white" | "grey0" | "navyblue" | "darkblue" | "blue3" | "blue3a" | "blue1" | "darkgreen" | "deepskyblue4" | "deepskyblue4a" | "deepskyblue4b" | "dodgerblue3" | "dodgerblue2" | "green4" | "springgreen4" | "turquoise4" | "deepskyblue3" | "deepskyblue3a" | "dodgerblue1" | "green3" | "springgreen3" | "darkcyan" | "lightseagreen" | "deepskyblue2" | "deepskyblue1" | "green3a" | "springgreen3a" | "springgreen2" | "cyan3" | "darkturquoise" | "turquoise2" | "green1" | "springgreen2a" | "springgreen1" | "mediumspringgreen" | "cyan2" | "cyan1" | "darkred" | "deeppink4" | "purple4" | "purple4a" | "purple3" | "blueviolet" | "orange4" | "grey37" | "mediumpurple4" | "slateblue3" | "slateblue3a" | "royalblue1" | "chartreuse4" | "darkseagreen4" | "paleturquoise4" | "steelblue" | "steelblue3" | "cornflowerblue" | "chartreuse3" | "darkseagreen4a" | "cadetblue" | "cadetbluea" | "skyblue3" | "steelblue1" | "chartreuse3a" | "palegreen3" | "seagreen3" | "aquamarine3" | "mediumturquoise" | "steelblue1a" | "chartreuse2" | "seagreen2" | "seagreen1" | "seagreen1a" | "aquamarine1" | "darkslategray2" | "darkreda" | "deeppink4a" | "darkmagenta" | "darkmagentaa" | "darkviolet" | "purplea" | "orange4a" | "lightpink4" | "plum4" | "mediumpurple3" | "mediumpurple3a" | "slateblue1" | "yellow4" | "wheat4" | "grey53" | "lightslategrey" | "mediumpurple" | "lightslateblue" | "yellow4a" | "darkolivegreen3" | "darkseagreen" | "lightskyblue3" | "lightskyblue3a" | "skyblue2" | "chartreuse2a" | "darkolivegreen3a" | "palegreen3a" | "darkseagreen3" | "darkslategray3" | "skyblue1" | "chartreuse1" | "lightgreen" | "lightgreena" | "palegreen1" | "aquamarine1a" | "darkslategray1" | "red3" | "deeppink4b" | "mediumvioletred" | "magenta3" | "darkvioleta" | "purpleb" | "darkorange3" | "indianred" | "hotpink3" | "mediumorchid3" | "mediumorchid" | "mediumpurple2" | "darkgoldenrod" | "lightsalmon3" | "rosybrown" | "grey63" | "mediumpurple2a" | "mediumpurple1" | "gold3" | "darkkhaki" | "navajowhite3" | "grey69" | "lightsteelblue3" | "lightsteelblue" | "yellow3" | "darkolivegreen3b" | "darkseagreen3a" | "darkseagreen2" | "lightcyan3" | "lightskyblue1" | "greenyellow" | "darkolivegreen2" | "palegreen1a" | "darkseagreen2a" | "darkseagreen1" | "paleturquoise1" | "red3a" | "deeppink3" | "deeppink3a" | "magenta3a" | "magenta3b" | "magenta2" | "darkorange3a" | "indianreda" | "hotpink3a" | "hotpink2" | "orchid" | "mediumorchid1" | "orange3" | "lightsalmon3a" | "lightpink3" | "pink3" | "plum3" | "violet" | "gold3a" | "lightgoldenrod3" | "tan" | "mistyrose3" | "thistle3" | "plum2" | "yellow3a" | "khaki3" | "lightgoldenrod2" | "lightyellow3" | "grey84" | "lightsteelblue1" | "yellow2" | "darkolivegreen1" | "darkolivegreen1a" | "darkseagreen1a" | "honeydew2" | "lightcyan1" | "red1" | "deeppink2" | "deeppink1" | "deeppink1a" | "magenta2a" | "magenta1" | "orangered1" | "indianred1" | "indianred1a" | "hotpink" | "hotpinka" | "mediumorchid1a" | "darkorange" | "salmon1" | "lightcoral" | "palevioletred1" | "orchid2" | "orchid1" | "orange1" | "sandybrown" | "lightsalmon1" | "lightpink1" | "pink1" | "plum1" | "gold1" | "lightgoldenrod2a" | "lightgoldenrod2b" | "navajowhite1" | "mistyrose1" | "thistle1" | "yellow1" | "lightgoldenrod1" | "khaki1" | "wheat1" | "cornsilk1" | "grey100" | "grey3" | "grey7" | "grey11" | "grey15" | "grey19" | "grey23" | "grey27" | "grey30" | "grey35" | "grey39" | "grey42" | "grey46" | "grey50" | "grey54" | "grey58" | "grey62" | "grey66" | "grey70" | "grey74" | "grey78" | "grey82" | "grey85" | "grey89" | "grey93"
<color24bit> ::= ( "x" | "#" ) <hexdigit> <hexdigit> <hexdigit> <hexdigit> <hexdigit> <hexdigit>
<decimal> ::= <digit> | <decimal> <digit>
<digit> ::= [0-9]
<hexdigit> ::= [0-9] | [a-f] | [A-F]
<string> ::= ([a-z] | [A-Z]) ( [0-9] | [a-z] | [A-Z] )+


Matti Rinta-Nikkola

unread,
Dec 13, 2020, 12:53:30 PM12/13/20
to jline-users
I found an issue that makes impossible to change only completion 'list' background because the constants  COMPLETION_STYLE_BACKGROUND and COMPLETION_STYLE_LIST_BACKGROUND have the same value (version 3.18.0 fixed in SNAPSHOT).

SNAPSHOT has other two improvements: 1) background styles are applied to the entire list/table cell. No more need to define background styles for COMPLETION_STYLE_LIST_DESCRIPTION, COMPLETION_STYLE_LIST_STARTING, etc.
2) If you have set JLine option group-persist then group names will be present also in completion 'list'.

Matti

Brad Wood

unread,
Dec 14, 2020, 1:32:08 PM12/14/20
to jline...@googlegroups.com
Thanks for the additional fixes.  I had noticed the overlap on the styles and had made the extra styles only applied when the LIST feature was enabled to work around it.

Thanks!

~Brad

Developer Advocate
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 


Reply all
Reply to author
Forward
0 new messages