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:
- 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:
- 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:
- 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.
Color Extractor¶
An enumerator for colour extractors. This determines how colours are approximated in character symbol output.
Color Space¶
An enumerator for colour spaces.
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:
- 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.
Tuck¶
An enumerator for tucking styles. To be used in a Placement
to specify what to do if the image doesn’t fit within the Canvas
’s bounds.
- class Tuck¶
- Bases:
- CHAFA_TUCK_STRETCH¶
Resize element to fit the area exactly, changing its aspect ratio.
- CHAFA_TUCK_FIT¶
Resize element to fit the area, preserving its aspect ratio by adding padding.
- CHAFA_TUCK_SHRINK_TO_FIT¶
Like CHAFA_TUCK_FIT , but prohibit enlargement.
- CHAFA_TUCK_MAX¶
Last supported tucking policy, plus one.
Added in version 1.2.0.
Align¶
An enumerator for Placement
’s available vertical- and horizontal alignments.
- class Align¶
- Bases:
- CHAFA_ALIGN_START¶
Align flush with beginning of the area (top or left in LTR locales).
- CHAFA_ALIGN_END¶
Align flush with end of the area (bottom or right in LTR locales).
- CHAFA_ALIGN_CENTER¶
Align in the middle of the area.
- CHAFA_ALIGN_MAX¶
Last supported alignment, plus one.
Added in version 1.2.0.
Terminal Sequences¶
An enumeration of the control sequences supported by TermInfo
.
- class TermSeq¶
- Bases:
- 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.