Skip to content

gh-81163: Add support for extended color functions in ncurses 6.1#17536

Merged
ned-deily merged 30 commits intopython:masterfrom
hpjansson:bpo36982
Aug 4, 2020
Merged

gh-81163: Add support for extended color functions in ncurses 6.1#17536
ned-deily merged 30 commits intopython:masterfrom
hpjansson:bpo36982

Conversation

@hpjansson
Copy link
Contributor

@hpjansson hpjansson commented Dec 9, 2019

This is a rebase of @websurfer5's #13534 against master, since that PR no longer applies cleanly and has not been updated since May. It now appears to pass the check that was failing in #13534 (review).

The original description from @websurfer5's PR follows.


ncurses 6.1 adds extended color functions to support terminals with 256 colors (e.g. xterm-256color). The extended functions use color-pair values that are signed integers because the existing functions only use signed short integer values that are too small to support the 65,536 color-pair values needed for a 256-color terminal.

The new extended color functions are used transparently by curses.color_content(), curses.init_color(), curses.init_pair(), and curses.pair_content() when available, and the original functions are used when they aren't. The module functions validate their parameters as signed integers when using the new extended functions and as signed short integers when using the original library functions to match the underlying ncurses function parameters. The original behavior remains unchanged when Python is built with a curses library that does not contain the new extended color functions.

A new function, curses.has_extended_color_support(), indicates whether extended color support is provided by the underlying ncurses library.

This PR also fixes issue #36630.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.