Skip to main content

Crate farben_core

Crate farben_core 

Source
Expand description

Core library for the farben terminal styling crate.

Provides the full pipeline for parsing farben markup strings into ANSI escape sequences: tokenization (lexer), ANSI encoding (ansi), rendering (parser), named style registration (registry), and error types (errors).

Typical usage flows through the lexer::tokenize and parser::render functions, with optional style definitions via the registry module and its macros.

Modules§

ansi
ANSI SGR escape sequence encoding for farben styles.
debug
Inverse rendering: turn parsed tokens back into farben markup syntax.
degrader
Color degradation for terminals that lack truecolor support.
env
Runtime detection of whether ANSI color output should be enabled.
errors
Error types for farben markup tokenization and registry operations.
lexer
Tokenizer for farben markup strings.
parser
Token stream renderer.
registry
Global named style registry.
strip
Utilities for stripping ANSI escape sequences from strings.

Functions§

active_stack
Returns a clone of the current persisted stack. Used by the parser at the start of render to resume from prior state.
clear_active_stack
Clears the persisted stack. Called by the upper layer after a non-bleed print (which appends \x1b[0m, so the terminal is back to a clean slate).
set_active_stack
Replaces the persisted stack. Used by the parser at the end of render to save its working state.