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

gui: only 256 color pairs supported even if ncurses supports more #1343

Closed
sim642 opened this issue Apr 28, 2019 · 0 comments

Comments

Projects
None yet
2 participants
@sim642
Copy link
Contributor

commented Apr 28, 2019

The following screenshot of /color buffer shows ncurses reporting support for 65536 color pairs but WeeChat's color pair allocation system still only uses 256 at most.
Screenshot by hexa- on #weechat:

WeeChat itself imposes this limit:

gui_color_term_colors = COLORS;
gui_color_term_color_pairs = COLOR_PAIRS;
gui_color_term_can_change_color = (can_change_color ()) ? 1 : 0;
gui_color_num_pairs = (gui_color_term_color_pairs >= 256) ?
255 : gui_color_term_color_pairs - 1;

The likely reason this limit is set in WeeChat is that when color pairs above 255 would be used in WeeChat through ncurses's COLOR_PAIR attribute macro, they wouldn't work because the macro only supports color pairs 0..255: https://invisible-island.net/ncurses/man/curs_color.3x.html#h3-COLOR_PAIR.

It should be possible to use more color pairs by selecting the color pair separately from attributes: https://invisible-island.net/ncurses/man/curs_attr.3x.html#h2-NOTES.

According to ncurses documentation the support for more than 256 color pairs only exists in ncurses ABI 6 and not ABI 5, which still seems to be used with ncurses 6.1 on Ubuntu etc. Nevertheless, fixing this issue should be possible and would benefit users who have ncurses ABI 6.

sim642 added a commit to sim642/weechat that referenced this issue May 2, 2019

sim642 added a commit to sim642/weechat that referenced this issue May 2, 2019

sim642 added a commit to sim642/weechat that referenced this issue May 2, 2019

sim642 added a commit to sim642/weechat that referenced this issue May 2, 2019

sim642 added a commit to sim642/weechat that referenced this issue May 4, 2019

gui: fix wbkgrndset for non-wide ncurses by fallback to wbkgdset (issue
weechat#1343)

cchar_t, setcchar and wbkgrndset are actually widec ncurses features,
not ext-colors features, but NCURSES_WIDECHAR doesn't accurately reflect
their existence so NCURSES_EXT_COLORS is used instead.

sim642 added a commit to sim642/weechat that referenced this issue May 13, 2019

@flashcode flashcode closed this in a9a1066 Jun 28, 2019

flashcode added a commit that referenced this issue Jun 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.