colorise.win package¶
Submodules¶
colorise.win.cluts module¶
-
colorise.win.cluts.
to_codes
(bg, color, attributes)[source]¶ Convert a set of attributes to Windows character attributes.
-
colorise.win.cluts.
color_from_name
(name, color_count, bg, attributes)[source]¶ Return the color value and color count for a given color name.
colorise.win.color_functions module¶
-
colorise.win.color_functions.
num_colors
()[source]¶ Get the number of colors supported by the terminal.
-
colorise.win.color_functions.
or_bit_flags
(*bit_flags)[source]¶ Bitwise OR together a list of bitflags into a single flag.
colorise.win.win32_functions module¶
Windows API functions.
-
colorise.win.win32_functions.
isatty
(handle)[source]¶ Check if a handle is a valid console handle.
For example, if a handle is redirected to a file, it is not a valid console handle and all win32 console API calls will fail.
-
colorise.win.win32_functions.
can_redefine_colors
()[source]¶ Return whether the terminal allows redefinition of colors.
-
colorise.win.win32_functions.
create_std_handle
(handle_id)[source]¶ Create a Windows standard handle from an identifier.
-
colorise.win.win32_functions.
get_win_handle
(target)[source]¶ Return the Windows handle corresponding to a Python handle.
-
colorise.win.win32_functions.
get_windows_clut
()[source]¶ Query and return the internal Windows color look-up table.
-
colorise.win.win32_functions.
enable_virtual_terminal_processing
(handle)[source]¶ Enable Windows processing of ANSI escape sequences.
-
colorise.win.win32_functions.
restore_console_mode
(handle, restore_mode)[source]¶ Restore the console mode for a handle to its original mode.
-
colorise.win.win32_functions.
restore_console_modes
()[source]¶ Restore console modes for stdout and stderr to their original mode.
-
colorise.win.win32_functions.
can_interpret_ansi
(file)[source]¶ Return True if the Windows console can interpret ANSI escape codes.
-
colorise.win.win32_functions.
set_console_text_attribute
(handle, flags)[source]¶ Set the console’s text attributes.
-
colorise.win.win32_functions.
encode_rgb_tuple
(rgb)[source]¶ Hexadecimally encode an rgb tuple as 0xbbggrr.
-
colorise.win.win32_functions.
redefine_colors
(color_map, file=sys.stdout)[source]¶ Redefine the base console colors with a new mapping.
This only redefines the 8 colors in the console and changes all text in the console that already uses the logical names. E.g. if ‘red’ is mapped to the color red and this function changes it to another color, all text in ‘red’ will be rendered with this new color, even though it may already have been written to the console.
colorise.win.winhandle module¶
Wrapper around Windows output handles.
-
colorise.win.winhandle.
validate
(handle)[source]¶ Classmethod: Check if a handle is valid to colorise.
-
colorise.win.winhandle.
from_sys_handle
(syshandle)[source]¶ Classmethod: Return the handle identifier for a python handle.
-
colorise.win.winhandle.
get_nonconsole_handle
(handle)[source]¶ Classmethod: Get a handle that works for non-console output streams.
-
colorise.win.winhandle.
valid
()[source]¶ Property: Return True if the handle is valid, False otherwise.
-
colorise.win.winhandle.
is_console_handle
()[source]¶ Property: Getter: If the handle is a valid console handle. Setter: Set if a handle is a valid console handle or not.
-
colorise.win.winhandle.
fg
()[source]¶ Property: Getter: Return the current foreground color set for the handle. Setter: Set the current foreground color.
-
colorise.win.winhandle.
bg
()[source]¶ Property: Getter: Return the current background color set for the handle. Setter: Set the current background color.
-
colorise.win.winhandle.
default_fg
()[source]¶ Property: Getter: Return the default foreground color set for the handle. Setter: Set the default foreground color.
-
colorise.win.winhandle.
default_bg
()[source]¶ Property: Getter: Return the default background color set for the handle. Setter: Set the default background color.