Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions 10 Doc/library/curses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ The module :mod:`curses` defines the following functions:

Return ``True`` if the terminal can display colors; otherwise, return ``False``.

.. function:: has_extended_color_support()

Return ``True`` if the module supports extended colors; otherwise, return
``False``. Extended color support allows more than 256 color-pairs for
terminals that support more than 16 colors (e.g. xterm-256color).

Extended color support requires ncurses version 6.1 or later.

.. versionadded:: 3.8


.. function:: has_ic()

Expand Down
23 changes: 15 additions & 8 deletions 23 Doc/whatsnew/3.8.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,21 @@ where the DLL is stored (if a full or partial path is used to load the initial
DLL) and paths added by :func:`~os.add_dll_directory`.


curses
-------

Added a new variable holding structured version information for the
underlying ncurses library: :data:`~curses.ncurses_version`.
(Contributed by Serhiy Storchaka in :issue:`31680`.)

The extended color functions added in ncurses 6.1 will be used transparently
by :func:`curses.color_content`, :func:`curses.init_color`,
:func:`curses.init_pair`, and :func:`curses.pair_content`. A new function,
:func:`curses.has_extended_color_support`, indicates whether extended color
support is provided by the underlying ncurses library.
(Contributed by Jeffrey Kintscher in :issue:`36982`.)


functools
---------

Expand Down Expand Up @@ -503,14 +518,6 @@ environment variable and does not use :envvar:`HOME`, which is not normally set
for regular user accounts.


ncurses
-------

Added a new variable holding structured version information for the
underlying ncurses library: :data:`~curses.ncurses_version`.
(Contributed by Serhiy Storchaka in :issue:`31680`.)


pathlib
-------

Expand Down
3 changes: 2 additions & 1 deletion 3 Lib/test/test_curses.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ def test_module_funcs(self):
curses.nocbreak, curses.noecho, curses.nonl,
curses.noqiflush, curses.noraw,
curses.reset_prog_mode, curses.termattrs,
curses.termname, curses.erasechar]:
curses.termname, curses.erasechar,
curses.has_extended_color_support]:
with self.subTest(func=func.__qualname__):
func()
if hasattr(curses, 'filter'):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Use ncurses extended color functions when available to support terminals with 256 colors, and add the new function :func:`curses.has_extended_color_support` to indicate whether extended color support is provided by the underlying ncurses library.
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.