On this page
curses.has_colors
Prev: curses.halfdelay | Up: curses | Next: curses.has_extended_color_support
Rel: curses.assume_default_colors, curses.baudrate, curses.beep, curses.can_change_color
Ref: docs.python.org — curses.has_colors
Tags: #public #python3 #stdlib #curses
Import
import curses
from curses import has_colors
Signature & Overview
curses.has_colors()
Return True if the terminal can display colors; otherwise, return False.
Usage
import curses
# Returns True if the terminal supports color (call after initscr() / inside wrapper())
assert callable(curses.has_colors)
Gotchas
- Always guard
curses.start_color()withif curses.has_colors():.
REPL Inspect
from curses import has_colors
help(has_colors)
Linked from
Related notes
- tuts/python3/stdlib_module/curses/halfdelay Linked here; links to this page; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/has_extended_color_support Linked here; links to this page; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/curses/assume_default_colors Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/baudrate Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/beep Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/can_change_color Linked here; shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/cbreak shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/color_content shared tags: #curses, #stdlib
- tuts/python3/stdlib_module/curses/color_pair shared tags: #curses, #stdlib