colorise.nix package

Submodules

colorise.nix.cluts module

Nix color look-up tables (CLUTs) and functions.

colorise.nix.cluts.can_redefine_colors()[source]

Return whether the terminal allows redefinition of colors.

colorise.nix.cluts.color_from_index(idx, color_count, bg, attributes)[source]

Return the color value and color count for a given color index.

colorise.nix.cluts.color_from_name(name, color_count, bg, attributes)[source]

Return the color value and color count for a given color name.

colorise.nix.cluts.get_clut(color_count)[source]

Return the appropriate color look-up table.

colorise.nix.cluts.get_prefix(color_count, bg)[source]

Get the color code prefix corresponding to the supported color count.

colorise.nix.cluts.get_rgb_color(color_count, bg, rgb, attributes)[source]

Get the color for an RGB triple or approximate it if necessary.

colorise.nix.color_functions module

Linux/Mac color functions.

colorise.nix.color_functions.attributes_to_codes(attributes)[source]

Convert a set of attributes to ANSI escape codes.

colorise.nix.color_functions.num_colors()[source]

Attempt to get the number of colors supported by the terminal.

colorise.nix.color_functions.redefine_colors(color_map, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Redefine the base console colors with a new mapping.

colorise.nix.color_functions.reset_color(file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>)[source]

Reset all colors and attributes.

colorise.nix.color_functions.set_color(fg=None, bg=None, attributes=[], file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, num_colors_func=<function num_colors>)[source]

Set color and attributes of the terminal.

‘fg’ and ‘bg’ specify foreground- and background colors while ‘attributes’ is a list of desired attributes. The ‘file’ keyword specifies the target output stream.

colorise.nix.color_functions.to_ansi(*codes)[source]

Convert a set of ANSI codes into a valid ANSI escape sequence.