Skip to content

Improve terminal color support for NetBeans (256color palette, truecolor) - #9741

Open
matthiasblaesing wants to merge 2 commits into
apache:masterfrom
matthiasblaesing:terminal_colors
Open

matthiasblaesing wants to merge 2 commits into
apache:masterfrom
matthiasblaesing:terminal_colors

Conversation

@matthiasblaesing

Copy link
Copy Markdown
Contributor

The NetBeans terminal has only rudimentary support for setting colors. For many use-case this is enough but more complex applications assume support for larger color ranges. One such example is "opencode". In NetBeans it currently looks like this:

grafik

Checking the supplied color codes turned out, that opencode sends sequences in the form \[38;2;<r>;<g>;<b>m and \[48;2;<r>;<g>;<b>m. These sequences carry 24bit color definitions.

This PR implements support for the 24bit sequences and also the 256 color palette index variant (\[38;5;<n>m, \[48;5;<n>m).

With this applied opencode is rendered like this:

grafik

The palette codes can be demoed with colortest-python tool:

Before:

grafik

After:

grafik

@matthiasblaesing matthiasblaesing added this to the NB33 milestone Oct 21, 2026
@matthiasblaesing matthiasblaesing added Code cleanup Label for cleanup done on the Netbeans IDE ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Oct 21, 2026

@mbien mbien left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! changes look good.

Comment on lines +223 to +227
if (i.field == AttrEncoding.BGCOLOR) {
fgColorUpdated = null;
} else if (i.field == AttrEncoding.BGCOLOR) {
bgColorUpdated = null;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something wrong here: both if check BG. First was probably meant for FG.

@neilcsmith-net

Copy link
Copy Markdown
Member

Yes, looks a great improvement. Thanks!

As a later step, and having spent a load of time last week fighting with the Output window, we might consider changes there and whether some of this attribute parsing code can be shared somewhere.

Nit : Improve Terminal color support in the title would be good for future release notes.

@matthiasblaesing matthiasblaesing changed the title Improve color support for NetBeans (256color palette, truecolor) Improve terminal color support for NetBeans (256color palette, truecolor) Oct 22, 2026
…and color palette mode

Bumps TERM variable to xterm-256colors and reports COLORTERM as truecolor
@matthiasblaesing

Copy link
Copy Markdown
Contributor Author

@mbien your finding is correct (the code was wrong). The intention was here that when one of the indexed colors is used, the true color value should be discarded.

@neilcsmith-net regarding the title. Yeah, in my mind the "terminal" was in that heading....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Code cleanup Label for cleanup done on the Netbeans IDE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants