farben-core 0.14.0

The internal core library for Farben
Documentation

farben-core

The internal core library for Farben

Crates.io Version docs.rs License MIT License Apache-2.0 Crates.io Downloads

[!WARNING] This crate is not intended for direct use. Its API is not stable and may change at any time without notice. Use the farben crate instead.

Contents

This crate contains the shared logic used by farben and farben-macros:

  • Lexer: tokenizes farben markup strings into a Vec<Token>
  • Parser: renders a token stream into an ANSI escape sequence string
  • ANSI: color and emphasis encoding via SGR escape codes
  • Errors: LexError, RegistryError, and LexErrorDisplay
  • Registry: global named style store for style!() and prefix!()
  • Strip: utilities for stripping ANSI, stripping markup tags, and escaping brackets
  • Degrader: color degradation for terminals without truecolor support
  • Inline: pre-processor for inline syntax (*bold*, /italic/, `code`)
  • Env: runtime detection of NO_COLOR, FORCE_COLOR, and TTY status
  • State: per-thread persistent style stack for bleed support
  • anstyle_conv: bidirectional conversion with anstyle types (requires anstyle feature)

License

Licensed under either of MIT License or Apache License, Version 2.0 at your option.

Cheers, RazkarStudio. (c) 2026 RazkarStudio. All rights reserved.