Enumerators

Canvas Mode

An enumerator for canvas modes. This determines how colours (and colour control codes) are used in the output from a canvas.An enumerator for canvas modes. This determines how colours (and colour control codes) are used in the output from a canvas.

class CanvasMode
Bases:

enum.IntEnum

CHAFA_CANVAS_MODE_TRUECOLOR

Truecolor.

CHAFA_CANVAS_MODE_INDEXED_256

256 colors.

CHAFA_CANVAS_MODE_INDEXED_240

256 colors, but avoid using the lower 16 whose values vary between terminal environments.

CHAFA_CANVAS_MODE_INDEXED_16

16 colors using the aixterm ANSI extension.

CHAFA_CANVAS_MODE_FGBG_BGFG

Default foreground and background colors, plus inversion.

CHAFA_CANVAS_MODE_FGBG

Default foreground and background colors. No ANSI codes will be used.

CHAFA_CANVAS_MODE_INDEXED_8

8 colors, compatible with original ANSI X3.64.

CHAFA_CANVAS_MODE_INDEXED_16_8

16 FG colors (8 of which enabled with bold/bright) and 8 BG colors.

CHAFA_CANVAS_MODE_MAX

Last supported canvas mode plus one.

Pixel Mode

An enumerator for pixel modes. This determines how pixel graphics are rendered in the output.

class PixelMode
Bases:

enum.IntEnum

CHAFA_PIXEL_MODE_SYMBOLS

Pixel data is approximated using character symbols (“ANSI art”).

CHAFA_PIXEL_MODE_SIXELS

Pixel data is encoded as sixels.

CHAFA_PIXEL_MODE_KITTY

Pixel data is encoded using the Kitty terminal protocol.

CHAFA_PIXEL_MODE_ITERM2

Pixel data is encoded using the iTerm2 terminal protocol.

CHAFA_PIXEL_MODE_MAX

Last supported pixel mode plus one.

Pixel Type

An enumerator for pixel types. These represent pixel formats supported by ChafaCanvas

class PixelType
Bases:

enum.IntEnum

CHAFA_PIXEL_RGBA8_PREMULTIPLIED

Premultiplied RGBA, 8 bits per channel.

CHAFA_PIXEL_BGRA8_PREMULTIPLIED

Premultiplied BGRA, 8 bits per channel.

CHAFA_PIXEL_ARGB8_PREMULTIPLIED

Premultiplied ARGB, 8 bits per channel.

CHAFA_PIXEL_ABGR8_PREMULTIPLIED

Premultiplied ABGR, 8 bits per channel.

CHAFA_PIXEL_RGBA8_UNASSOCIATED

Unassociated RGBA, 8 bits per channel.

CHAFA_PIXEL_BGRA8_UNASSOCIATED

Unassociated BGRA, 8 bits per channel.

CHAFA_PIXEL_ARGB8_UNASSOCIATED

Unassociated ARGB, 8 bits per channel.

CHAFA_PIXEL_ABGR8_UNASSOCIATED

Unassociated ABGR, 8 bits per channel.

CHAFA_PIXEL_RGB8

Packed RGB (no alpha), 8 bits per channel.

CHAFA_PIXEL_BGR8

Packed BGR (no alpha), 8 bits per channel.

CHAFA_PIXEL_MAX

Last supported pixel type, plus one.

Dither Mode

An enumerator for dither modes. This determines how dithering will be applied to the canvas when drawing.

class DitherMode
Bases:

enum.IntEnum

CHAFA_DITHER_MODE_NONE

No dithering.

CHAFA_DITHER_MODE_ORDERED

Ordered dithering (Bayer or similar).

CHAFA_DITHER_MODE_DIFFUSION

Error diffusion dithering (Floyd-Steinberg or similar).

CHAFA_DITHER_MODE_MAX

Last supported dither mode plus one.

Color Extractor

An enumerator for colour extractors. This determines how colours are approximated in character symbol output.

class ColorExtractor
Bases:

enum.IntEnum

CHAFA_COLOR_EXTRACTOR_AVERAGE

Use the average colors of each symbol’s coverage area.

CHAFA_COLOR_EXTRACTOR_MEDIAN

Use the median colors of each symbol’s coverage area.

CHAFA_COLOR_EXTRACTOR_MAX

Last supported color extractor plus one.

Color Space

An enumerator for colour spaces.

class ColorSpace
Bases:

enum.IntEnum

CHAFA_COLOR_SPACE_RGB

RGB color space. Fast but imprecise.

CHAFA_COLOR_SPACE_DIN99D

DIN99d color space. Slower, but good perceptual color precision.

CHAFA_COLOR_SPACE_MAX

Last supported color space plus one.

Optimizations

An enumerator for optimizations. When enabled, these may produce more compact output at the cost of reduced compatibility and increased CPU use. Output quality is unaffected.

class Optimizations
Bases:

enum.IntEnum

CHAFA_OPTIMIZATION_REUSE_ATTRIBUTES

Suppress redundant SGR control sequences.

CHAFA_OPTIMIZATION_SKIP_CELLS

Reserved for future use.

CHAFA_OPTIMIZATION_REPEAT_CELLS

Use REP sequence to compress repeated runs of similar cells.

CHAFA_OPTIMIZATION_NONE

All optimizations disabled.

CHAFA_OPTIMIZATION_ALL

All optimizations enabled.

Symbol Tags

An enumerator for symbol tags. This can be used in SymbolMap.add_by_tags() to specify which symbols to use in the output of a Canvas.

class SymbolTags
Bases:

enum.IntEnum

CHAFA_SYMBOL_TAG_NONE

Special value meaning no symbols.

CHAFA_SYMBOL_TAG_SPACE

Space.

CHAFA_SYMBOL_TAG_SOLID

Solid (inverse of space).

CHAFA_SYMBOL_TAG_STIPPLE

Stipple symbols.

CHAFA_SYMBOL_TAG_BLOCK

Block symbols.

CHAFA_SYMBOL_TAG_BORDER

Border symbols.

CHAFA_SYMBOL_TAG_DIAGONAL

Diagonal border symbols.

CHAFA_SYMBOL_TAG_DOT

Symbols that look like isolated dots (excluding Braille).

CHAFA_SYMBOL_TAG_QUAD

Quadrant block symbols.

CHAFA_SYMBOL_TAG_HHALF

Horizontal half block symbols.

CHAFA_SYMBOL_TAG_VHALF

Vertical half block symbols.

CHAFA_SYMBOL_TAG_HALF

Joint set of horizontal and vertical halves.

CHAFA_SYMBOL_TAG_INVERTED

Symbols that are the inverse of simpler symbols. When two symbols complement each other, only one will have this tag.

CHAFA_SYMBOL_TAG_BRAILLE

Braille symbols.

CHAFA_SYMBOL_TAG_TECHNICAL

Miscellaneous technical symbols.

CHAFA_SYMBOL_TAG_GEOMETRIC

Geometric shapes.

CHAFA_SYMBOL_TAG_ASCII

Printable ASCII characters.

CHAFA_SYMBOL_TAG_ALPHA

Letters.

CHAFA_SYMBOL_TAG_DIGIT

Digits.

CHAFA_SYMBOL_TAG_ALNUM

Joint set of letters and digits.

CHAFA_SYMBOL_TAG_NARROW

Characters that are one cell wide.

CHAFA_SYMBOL_TAG_WIDE

Characters that are two cells wide.

CHAFA_SYMBOL_TAG_AMBIGUOUS

Characters of uncertain width. Always excluded unless specifically asked for.

CHAFA_SYMBOL_TAG_UGLY

Characters that are generally undesired or unlikely to render well. Always excluded unless specifically asked for.

CHAFA_SYMBOL_TAG_LEGACY

Legacy computer symbols, including sextants, wedges and more.

CHAFA_SYMBOL_TAG_SEXTANT

Sextant 2x3 mosaics.

CHAFA_SYMBOL_TAG_WEDGE

Wedge shapes that align with sextants.

CHAFA_SYMBOL_TAG_LATIN

Latin and Latin-like symbols (superset of ASCII).

CHAFA_SYMBOL_TAG_EXTRA

Symbols not in any other category.

CHAFA_SYMBOL_TAG_BAD

Joint set of ugly and ambiguous characters. Always excluded unless specifically asked for.

CHAFA_SYMBOL_TAG_ALL

Special value meaning all supported symbols.

Terminal Sequences

An enumeration of the control sequences supported by TermInfo.

class TermSeq
Bases:

enum.IntEnum

CHAFA_TERM_SEQ_RESET_TERMINAL_SOFT

Reset the terminal to configured defaults.

CHAFA_TERM_SEQ_RESET_TERMINAL_HARD

Reset the terminal to factory defaults.

CHAFA_TERM_SEQ_RESET_ATTRIBUTES

Reset active graphics rendition (colors and other attributes) to terminal defaults.

CHAFA_TERM_SEQ_CLEAR

Clear the screen.

CHAFA_TERM_SEQ_INVERT_COLORS

Invert foreground and background colors (disable with RESET_ATTRIBUTES).

CHAFA_TERM_SEQ_CURSOR_TO_TOP_LEFT

Move cursor to top left of screen.

CHAFA_TERM_SEQ_CURSOR_TO_BOTTOM_LEFT

Move cursor to bottom left of screen.

CHAFA_TERM_SEQ_CURSOR_TO_POS

Move cursor to specific position.

CHAFA_TERM_SEQ_CURSOR_UP_1

Move cursor up one cell.

CHAFA_TERM_SEQ_CURSOR_UP

Move cursor up N cells.

CHAFA_TERM_SEQ_CURSOR_DOWN_1

Move cursor down one cell.

CHAFA_TERM_SEQ_CURSOR_DOWN

Move cursor down N cells.

CHAFA_TERM_SEQ_CURSOR_LEFT_1

Move cursor left one cell.

CHAFA_TERM_SEQ_CURSOR_LEFT

Move cursor left N cells.

CHAFA_TERM_SEQ_CURSOR_RIGHT_1

Move cursor right one cell.

CHAFA_TERM_SEQ_CURSOR_RIGHT

Move cursor right N cells.

CHAFA_TERM_SEQ_CURSOR_UP_SCROLL

Move cursor up one cell. Scroll area contents down when at the edge.

CHAFA_TERM_SEQ_CURSOR_DOWN_SCROLL

Move cursor down one cell. Scroll area contents up when at the edge.

CHAFA_TERM_SEQ_INSERT_CELLS

Insert blank cells at cursor position.

CHAFA_TERM_SEQ_DELETE_CELLS

Delete cells at cursor position.

CHAFA_TERM_SEQ_INSERT_ROWS

Insert rows at cursor position.

CHAFA_TERM_SEQ_DELETE_ROWS

Delete rows at cursor position.

CHAFA_TERM_SEQ_SET_SCROLLING_ROWS

Set scrolling area extents.

CHAFA_TERM_SEQ_ENABLE_INSERT

Enable insert mode.

CHAFA_TERM_SEQ_DISABLE_INSERT

Disable insert mode.

CHAFA_TERM_SEQ_ENABLE_CURSOR

Show the cursor.

CHAFA_TERM_SEQ_DISABLE_CURSOR

Hide the cursor.

CHAFA_TERM_SEQ_ENABLE_ECHO

Make the terminal echo input locally.

CHAFA_TERM_SEQ_DISABLE_ECHO

Don’t echo input locally.

CHAFA_TERM_SEQ_ENABLE_WRAP

Make cursor wrap around to the next row after output in the final column.

CHAFA_TERM_SEQ_DISABLE_WRAP

Make cursor stay in place after output to the final column.

CHAFA_TERM_SEQ_SET_COLOR_FG_DIRECT

Set foreground color (directcolor/truecolor).

CHAFA_TERM_SEQ_SET_COLOR_BG_DIRECT

Set background color (directcolor/truecolor).

CHAFA_TERM_SEQ_SET_COLOR_FGBG_DIRECT

Set foreground and background color (directcolor/truecolor).

CHAFA_TERM_SEQ_SET_COLOR_FG_256

Set foreground color (256 colors).

CHAFA_TERM_SEQ_SET_COLOR_BG_256

Set background color (256 colors).

CHAFA_TERM_SEQ_SET_COLOR_FGBG_256

Set foreground and background colors (256 colors).

CHAFA_TERM_SEQ_SET_COLOR_FG_16

Set foreground color (16 colors).

CHAFA_TERM_SEQ_SET_COLOR_BG_16

Set background color (16 colors).

CHAFA_TERM_SEQ_SET_COLOR_FGBG_16

Set foreground and background colors (16 colors).

CHAFA_TERM_SEQ_BEGIN_SIXELS

Begin sixel image data.

CHAFA_TERM_SEQ_END_SIXELS

End sixel image data.

CHAFA_TERM_SEQ_REPEAT_CHAR

Repeat previous character N times.

CHAFA_TERM_SEQ_BEGIN_KITTY_IMMEDIATE_IMAGE_V1

Begin upload of Kitty image for immediate display at cursor.

CHAFA_TERM_SEQ_END_KITTY_IMAGE

End of Kitty image upload.

CHAFA_TERM_SEQ_BEGIN_KITTY_IMAGE_CHUNK

Begin Kitty image data chunk.

CHAFA_TERM_SEQ_END_KITTY_IMAGE_CHUNK

End Kitty image data chunk.

CHAFA_TERM_SEQ_BEGIN_ITERM2_IMAGE

Begin iTerm2 image data.

CHAFA_TERM_SEQ_END_ITERM2_IMAGE

End of iTerm2 image data.

CHAFA_TERM_SEQ_ENABLE_SIXEL_SCROLLING

Enable sixel scrolling.

CHAFA_TERM_SEQ_DISABLE_SIXEL_SCROLLING

Disable sixel scrolling.

CHAFA_TERM_SEQ_ENABLE_BOLD

Enable boldface (disable with RESET_ATTRIBUTES).

CHAFA_TERM_SEQ_SET_COLOR_FG_8

Set foreground color (8 colors).

CHAFA_TERM_SEQ_SET_COLOR_BG_8

Set background color (8 colors).

CHAFA_TERM_SEQ_SET_COLOR_FGBG_8

Set foreground and background colors (8 colors).

CHAFA_TERM_SEQ_MAX

Last control sequence plus one.