Crate termcinema_engine

Crate termcinema_engine 

Source
Expand description

Terminal Cinematic Renderer — render styled terminal sessions as SVG animations.

This crate provides the core logic for formatting, styling, and rendering terminal-like output (shell sessions, REPLs, CLI tools) into SVG or other formats.

It exposes configurable options for font, color, layout, cursor behavior, and animation control.

§Key Features

  • Built-in theme presets (ThemePreset)
  • Style and layout config (StyleSpec, LayoutSpec, etc.)
  • Typing animations with customizable speed and fade (ControlSpec)
  • Font resolution (embedded + system fonts)
  • Text parsing for shell/REPL-style sessions

For CLI integration, see termcinema-cli. For advanced control, access core APIs directly.

Powered by Rust 🦀 + SVG ✨

Structs§

CommandGroup
Grouped command entry with associated I/O segments.
ContentSpec
Content specification: raw text input, unstructured.
ControlSpec
Controls playback behavior of the SVG animation.
CursorSpec
Cursor style specification used in rendering and theming.
LayoutSpec
Layout configuration for the rendering canvas.
StyleSpec
Visual style configuration for font and color settings.
ThemePreset
Represents a full visual theme preset.

Enums§

TextAlign
Horizontal text alignment options.
ThemeError
Errors that can occur during theme resolution.
VerticalAlign
Vertical alignment options for block positioning.

Constants§

DEFAULT_CONTROL_FADE_DURATION
Duration of character fade-in, in milliseconds.
DEFAULT_CONTROL_FRAME_DELAY
Delay between each character during typing, in milliseconds.
DEFAULT_CONTROL_START_DELAY
Delay before animation starts, in milliseconds.
DEFAULT_CURSOR_BLINK
Whether cursor blinking is enabled by default.
DEFAULT_CURSOR_BLINK_MS
Default blinking interval in milliseconds.
DEFAULT_CURSOR_CHAR
Default cursor character (e.g. vertical bar).
DEFAULT_CURSOR_OFFSET_X
Horizontal cursor offset in pixels.
DEFAULT_CURSOR_OPACITY
Cursor opacity from 0.0 (transparent) to 1.0 (fully visible).
DEFAULT_STYLE_BACKGROUND_COLOR
Default background color in hexadecimal (e.g. black).
DEFAULT_STYLE_FONT_FAMILY
Default font family name (used in CSS font-family).
DEFAULT_STYLE_FONT_SIZE
Default font size in pixels.
DEFAULT_STYLE_TEXT_COLOR
Default text color in hexadecimal (e.g. white).

Functions§

all_presets
Returns a list of all built-in theme presets.
get_theme_by_name
Looks up a theme by its display name (case-insensitive).
list_builtin_system_fonts
Returns a whitelist of system fonts considered monospace-safe.
list_embeddable_font_families
Returns a list of all embeddable CSS font-family names.
recommended_fonts_for_current_os
Suggest recommended fonts based on the current operating system.
render_repl_from_script
Render a REPL-style SVG from shell script input.
render_svg_from_input
Render a full SVG output based on raw text input and display mode.
render_typing_from_text
Render a typing-style SVG from raw text.
resolve_embedded_font
Resolve a font by its CSS font-family name.
resolve_theme
Resolves a theme by name (case-insensitive, underscores allowed).