Changelog
core0.13.4 / macros0.6.0 / frb0.18.0 / build0.1.4Global
Added
strip_markup(input: &str) -> Stringinfarben-core::strip: strips farben markup tags from a string, returning plain text. Re-exported fromfarbenasfarben::strip_markup.markup_strip!macro that behaves the same asansi_strip!but usesstrip_markuprender_forced(tokens: Vec<Token>) -> Stringinfarben-core::parser: renders tokens to ANSI unconditionally, bypassingcolor_enabled(). Used internally bycolor!andcolorb!to ensure the styled variant is always baked in regardless of the build environment.FarbenStrinfarben: a compile-time string pair holding both a styled and plain&'static strvariant. Resolved at the end user's runtime viaFarbenStr::resolve()andDisplay.color_enabled()re-exported fromfarben: previously only accessible viafarben_coredirectly.- Doc comments in
init_styles()offarben_build.
Changed
color!andcolorb!now emit aFarbenStrinstead of a bare&'static str, baking both ANSI and plain variants into the binary and deferringNO_COLOR/FORCE_COLOR/TTY detection to the end user's runtime.render()now delegates its ANSI rendering path torender_forced().- The
FORCE_COLORbuild-time hack incolor!andcolorb!has been removed.
Breaking
color!andcolorb!no longer return&'static str. Code storing the result directly as&strmust call.resolve()explicitly. Usage insidecprintln!,cprint!,cwrite!, and all other print/write macros is unaffected.- Migration guides are in the repo's CHANGELOG.
build0.1.3farben-build
Added
coremodule, exposing some library internals for users that want to use them- Documentation
core0.13.3 / frb0.17.3Global
Added
LexError::display(input)infarben-core— returns aLexErrorDisplaywrapper that formats the error with a caret pointing at the offending byte in the original input. Previously, this caret-style diagnostic was only available through the panic path infarben's macros; graceful callers oftry_colorcould only access the plain one-lineDisplayimpl. The new method exposes the rich diagnostic toResult-based error handling.
Changed
farben-coredependency infarbenbumped tocore0.13.3.
core0.13.2 / frb0.17.2 / build0.1.2Global
Added
active_stack(),set_active_stack(), andclear_active_stack()infarben-core— public API for managing the thread-local persisted style stack acrossrender()calls.farben-buildnow emitscargo:rerun-if-changeddirectives for each config file path, so edits to.frb.tomlfiles correctly invalidate cached builds without requiringcargo clean.
Fixed
- Bleed-style prints (
cprintb!,cprintbln!) now correctly preserve the active style stack across calls. Previously,render()reset its internal stack between invocations, so a targeted reset like[/red]after a bleed call would emit a full reset and silently drop other active styles likebold. The stack is now persisted per-thread viathread_local!, resumed at the start of eachrender(), and cleared bycolor_runtime()after non-bleed prints append their trailing reset. farben-buildgenerated code now uses Rust'sDebugformatter to embed style and prefix names, properly escaping quotes, backslashes, and control characters. Previously, names containing special characters could produce invalid Rust in the generated file.
farben-core 0.13.1 / farben-macros 0.5.2 / farben-build 0.1.1 / farben-md 0.2.2 / farben 0.17.1Global
Added
- Comprehensive docstrings for all public items across the workspace!
Fixed
- Fixed bugs
farben-core 0.13.0 / farben 0.17.0Global
Added
EmphasisType::Overline(SGR 53),EmphasisType::Invisible(SGR 8),EmphasisType::Reverse(SGR 7),EmphasisType::RapidBlink(SGR 6),EmphasisType::DoubleUnderline(SGR 21) — new emphasis variants with corresponding[overline],[invisible],[reverse],[rapid-blink],[double-underline]tags.debugmodule infarben-core—tokens_to_markup(tokens)reconstructs a farben markup string from a parsed token slice, collapsing consecutive tags into a single bracket.expand!(markup)infarben— diagnostic macro that prints three lines to stderr: the raw input, the fully expanded markup (registry styles resolved to their constituent tags), and the rendered ANSI escape string.
Changed
farben-coredependency infarbenbumped to0.13.0.
farben-core 0.12.1 / farben 0.16.3Global
Fixed
tokenizeno longer misinterprets\x1b[(CSI ANSI escape sequences) as tag openers. The byte preceding each[is checked; if it isESC(0x1b), the character is treated as plain text and the loop continues. Previously, strings containing raw ANSI codes passed tocolor()ortry_color()would erroneously returnLexError::UnclosedTag.
farben 0.16.2farben
Added
farben::coremodule - exposesstyle_to_ansi()function for convertingfarben::Styleinto ANSI escape sequences.
farben 0.16.1farben
Fixed
anstyle!macro no longer requiresfarben_corecrate as a direct dependency for users, the macro now usesfarben::Styleinstead.- Tests no longer fail in non-TTY environments, the parser now respects the
FORCE_COLORenvironment variable in all tests.
farben-core 0.12.0 / farben 0.16.0Global
Added
anstylefeature flag - enables interoperability with theanstylecrate.anstyle_convmodule infarben-core- provides bidirectionalFromimplementations for converting between farben types (Color,NamedColor,Style) andanstyletypes (anstyle::Color,anstyle::AnsiColor,anstyle::Style).anstyle!macro infarben- parses farben markup and converts the result into ananstyle::Style. Requires theanstylefeature flag.anstylecrate added as an optional dependency to bothfarben-coreandfarben.
farben-core 0.11.0 / farben 0.15.0Global
Added
- ~1.4x faster on average across the core pipeline (geometric mean of 7 benchmarks vs v0.14). ANSI encoding sees the largest gains: named color encoding is 1.9x faster, RGB encoding 1.7x faster, emphasis sequences 1.6x faster. The full tokenize-to-render pipeline is 1.35x faster.
- Breaking (farben-core 0.11.0):
TagType::Reset(Option<Box<TagType>>)split intoTagType::ResetAll(wasReset(None)) andTagType::ResetOne(Box<TagType>)(wasReset(Some(...))). Update all match arms that pattern-match onTagType::Reset. - Breaking (farben-core 0.11.0):
Token::Text(String)is nowToken::Text(Cow<'static, str>). UseCow::Owned(string)for runtime strings orCow::Borrowed("literal")for static literals. Pattern-matching andpush_strusage are unaffected. - Criterion benchmark suite added to
farben-core/benches/farben_bench.rscovering tokenize, render, full pipeline,emphasis_to_ansi,color_to_ansi(named and RGB), and registry lookup. - Tests for
renderwith color disabled: verifies tag tokens are stripped and only text and prefix content is emitted. - Edge case tests for
strip_ansi: empty string, bare ESC byte, sequences-only input, mixed content, RGB and ANSI256 sequences. - Release profile:
lto = "thin",codegen-units = 1,opt-level = 3in rootCargo.tomlfor cross-crate inlining in release builds. - Reduced allocations across the hot path: token
Vecpre-allocated, render buffer pre-sized,emphasis_to_ansiandcolor_to_ansibypass intermediateVec<u8>, registry lookups clone anArcinstead of a fullStyle. - Redundant prefix scans in
parse_partconsolidated to a singlestrip_prefixper tag type. env.rsunsafe blocks annotated with// SAFETY:comments.- Performance vs v0.14 (criterion 0.5.1, x86-64 Linux): tokenize plain -22%, tokenize complex -26%, pipeline -26%,
emphasis_to_ansi-37%,color_to_ansinamed -47%,color_to_ansiRGB -43%, registry lookup -5%, render -2% (within noise).
farben-build 0.1.0 / farben-macros 0.5.0 / farben-core 0.10.0 / farben-md 0.2.0 / farben 0.14.0Global
Added
farben-build0.1.0 - a new build script helper crate. Callfarben_build::run()frombuild.rsto readfarben.frb.tomland generate two artifacts inOUT_DIR:farben_styles.rs(a Rust source file containing aninit_styles()function that registers all styles and prefixes at runtime viaload_styles!()) andfarben_registry.lsv(a line-separated values file consumed byfarben-macrosproc macros at compile time). Usefarben_build::run_with(&[paths])to supply custom config file paths instead of the default. Config files use a TOML format with[styles]and[prefixes]sections. Namespaced sections like[styles.myns]produce keys of the formmyns:key.- Absolutely zero external dependencies added.
Changed
farben-macrosbumped to0.5.0. Every proc macro invocation now callsload_registry()at startup, which readsfarben_registry.lsvfromOUT_DIRand pre-populates the compile-time registry. As a result,color!,colorb!, andvalidate_color!now resolve user-defined style tags (e.g.[myTag]) that were declared in a.frb.tomlconfig file.farben-corebumped to0.10.0. No new public API.farben-mdbumped to0.2.0, picking up thefarben-core 0.10.0dependency. No new public API.
0.9.0farben-core
Added
- Lossy degrading. When the terminal does not support 24-bit true color, RGB values are automatically degraded to the nearest ANSI256 color. When the terminal only supports basic ANSI colors (8/16 colors), RGB and ANSI256 values are degraded to the nearest named color. The degrader module uses the
COLORTERMandTERMenvironment variables to detect terminal color capabilities at runtime.
0.13.0farben
Changed
farben-coredependency bumped to0.9.0, picking up lossy degrading support.
0.12.0farben
Added
cwrite!,cwriteln!,cwriteb!,cwritebln!- writer variants of the colored print macros. Work with anyWriteimplementor. Useful for writing to files,Stringbuffers, or custom writers. All four support the same markup features as the stdout variants (named colors, RGB, ANSI256, emphasis, bleeding via thebvariants).
0.8.0farben-core
Added
RegistryErrorenum - a separate error type for registry operations (set_prefix,insert_style). Split out fromLexErrorbecause registry errors have no source position (they occur outside markup parsing). Has one variant:UnknownStyle(String).LexErrorDisplay<'a>struct - wraps a&LexErrorand the original&strinput to produce compiler-style diagnostic output. Renders two lines: the full input string, then a caret (^) aligned to the byte offset of the error.
Changed
- All
LexErrorvariants now carry aposition: usizefield (byte offset into the markup string). Affected variants:UnclosedTag,InvalidTag,UnclosedValue,InvalidArgumentCount,InvalidValue,InvalidResetTarget. Previously no variants stored position info. LexError::UnknownStyleremoved - registry errors now useRegistryError::UnknownStyleinstead.LexError'sDisplayimpl now includes position in every message (e.g."invalid tag 'foo' at position 5").
0.11.0farben
Added
farben::preludemodule - the recommended import path going forward.use farben::prelude::*brings every user-facing item into scope (functions, macros, types) gated by the same feature flags as their definitions. Prefer this overuse farben::*, which also pulls incolor_runtimeandvalidate_color- items that arepubonly to satisfy macro expansion, not intended for direct use.
Changed
farben-coredependency bumped to0.8.0, picking up position-awareLexErrorvariants and the newLexErrorDisplaydiagnostic formatter.try_colorerror messages now include the byte offset of the offending token.- All documentation and examples updated to use
use farben::prelude::*.
0.10.0farben
Added
ansi_strip!(...)macro that acceptsformat!-style arguments, builds the string, then strips all CSI ANSI escape sequences from the result. Non-CSIESCbytes pass through unchanged. ReturnsString.strip_ansire-exported at thefarbencrate root fromfarben-core::strip::strip_ansi. Available viause farben::*.
Changed
farben-coredependency bumped to0.7.0.
0.7.0farben-core
Added
envmodule: runtime detection of whether ANSI color output should be enabled. RespectsNO_COLORandFORCE_COLORenvironment variable conventions, then falls back to TTY detection. Result is computed once per process and cached viaOnceLock. TTY detection viaisatty(1)on Unix,GetConsoleModeon Windows,falseelsewhere.stripmodule:strip_ansi(input)removes CSI ANSI escape sequences (ESC [ ... <letter>) from a string and returns plain text. Non-CSIESCbytes are passed through unchanged.- Zero dependencies added to core library internals.
0.9.0farben
Added
ceprint!,ceprintln!,ceprintb!,ceprintbln!, stderr variants of the colored print macros.mdeprint!,mdeprintln!, stderr variants of the inline markdown print macros.- Empty invocation support for all print macros.
cprintln!()now prints a bare newline,cprint!()prints nothing. Applies toceprint!,ceprintln!,mdprint!,mdprintln!,mdeprint!, and all bleed variants.
Changed
src/lib.rssplit into focused modules:functions.rs,macros/color.rs,macros/format.rs,macros/markdown.rs,macros/eprint.rs, andtests.rs. No public API changes.
0.8.3farben
Fixed
prefix!macro no longer required users to manually addfarben-coreas a dependency. Theset_prefixfunction is now re-exported throughfarbenand the macro expands viafarben::set_prefix.color_fmt!,cprint!,cprintln!,cprintb!, andcprintbln!(compile feature) no longer requirefarben-macrosas a direct dependency.validate_coloris now re-exported throughfarben
0.1.2farben-md
Fixed
- Unclosed delimiters (
**,*,_,__,~~) incorrectly produced styled tokens instead of falling back to plain text.tokenize_innerreturn type changed fromVec<MdToken>to(Vec<MdToken>, bool)to distinguish a found closing delimiter from end-of-input exhaustion. - Added
tokens_to_texthelper to reconstruct plain text from partially parsed token trees when a closing delimiter is never found.
Added
- Full unit test suite for
lexer.rsandrenderer.rscovering plain text, all six token types, nesting, unclosed delimiters, empty input, mixed content, and consecutive spans.
0.8.1 / 0.6.3 / 0.4.1 / 0.1.1Global
Changed
- Changed LICENSE to MIT/Apache-2.0
0.1.0farben-md
Added
tokenize()- parses inline markdown into a recursiveMdTokentree. Supports**bold**,*italic*,_italic_,__underline__,~~strikethrough~~, and`inline code`. Unclosed delimiters are treated as plain text.render()- converts anMdTokentree into an ANSI-escaped string. Nested spans are handled via an active style stack that re-emits surviving styles after each reset.MdToken- recursive token enum.Text(String)andCode(String)are leaf nodes;Bold,Italic,Underline, andStrikethroughcarryVec<MdToken>.
0.4.0farben-macros
Added
markdown!()- proc macro that parses and renders inline markdown at compile time, emitting the final ANSI-escaped string baked into the binary. Enabled via themarkdownfeature.
0.8.0farben
Added
markdown()- runtime function that parses and renders inline markdown into an ANSI-escaped string. Always succeeds. Enabled via themarkdownfeature.md_fmt!()- renders inline markdown with format arguments. Always runtime. Enabled via themarkdownfeature.mdprint!()- prints inline markdown to stdout without a newline. Runtime undermarkdown, compile-time undermarkdown-compile.mdprintln!()- prints inline markdown to stdout with a trailing newline. Runtime undermarkdown, compile-time undermarkdown-compile.markdownfeature - enables runtime markdown rendering viafarben-md.markdown-compilefeature - enables bothmarkdownandcompilewith compile-time rendering viafarben-macros.
Changed
style!()andprefix!()macros moved fromfarben-coretofarben, under theformatfeature flag.
0.8.0 / 0.4.0 / 0.1.0Global
Added
farben-md- new crate providing inline markdown tokenization and ANSI rendering. Depends onfarben-corefor ANSI encoding.color_to_ansi()andemphasis_to_ansi()made public infarben-core0.6.2, enablingfarben-mdto delegate ANSI encoding without reimplementing it.
0.6.2farben-core
Changed
- Made
style_to_ansi()andemphasis_to_ansi()public functions.
0.7.1farben
Added
style!()- moved fromfarben-core. Defines a named style in the global registry. Gated behind theformatfeature.prefix!()- moved fromfarben-core. Sets a prefix string on a previously defined named style. Gated behind theformatfeature.
0.6.1farben-core
Changed
style!()- moved tofarben. Users importing directly fromfarben-coreshould update tofarben::style!().prefix!()- moved tofarben. Users importing directly fromfarben-coreshould update tofarben::prefix!().
0.3.1farben-macros
Changed
- Minor dependency update to
farben-core.
0.3.0farben-macros
Changed
colorb!- replaced one-line stub doc with a full doc comment explaining what bleed means, when to use it, and how it differs fromcolor!. Includes a working example.validate_color!- removed misleading user-facing example. Doc comment now explicitly marks it as internal and directs users towardcolor!andcolor_fmt!.
0.7.0farben
Added
colorb- added missing doc comment explaining bleed behavior and when to use it overcolor.color_fmt!(compile-time variant) - added missing doc comment. Previously the runtime variant was documented but thecompile-feature counterpart had none.
Changed
- Crate-level doc comment revised: fixed grammar and capitalized "German".
Fixed
cprint!(compile-time variant) - example referenced unbound variablemessage. Added declaration so it compiles as a doctest.cprintln!(compile-time variant) - example referenced unbound variableresult. Added declaration so it compiles as a doctest.test_try_color_inline_reset- strengthened assertion to a full equality check against the expected output"\x1b[31mbefore\x1b[0mafter\x1b[0m".
0.6.0farben-core
Added
LexError::InvalidResetTarget- returned when a reset tag targets something that cannot be reset (e.g.[//]or[/prefix]). Previously caused a panic.LexError::UnknownStyle- returned byregistry::set_prefixwhen the given style name has not been registered.registry::set_prefixnow returnsResult<(), LexError>instead of(), allowing callers to handle unknown style names without panicking.
Changed
ansi::style_to_ansipromoted frompub(crate)topub. Users building on top offarben-corecan now call it directly.ansi::style_to_ansi- removed#[allow(unused)]now that it is part of the public API.registry::prefix!macro updated to call.expect()on theResultreturned byset_prefix, preserving panic-on-misuse at the macro callsite.LexError::InvalidArgumentCountdisplay improved from"expected N, got M"to"expected N arguments, got M".
Fixed
lexer::parse_part- replacedpanic!withErr(LexError::InvalidResetTarget)when a reset tag targets aResetorPrefixnode.registry::set_prefix- replacedpanic!withErr(LexError::UnknownStyle)when the style name is not found in the registry.errors.rs- corrected typo inUnclosedValuedisplay: "parantheses" → "parentheses".ansi::NamedColordoc comment - corrected "eight standard ANSI named colors" to "sixteen ANSI named colors".ansi::style_to_ansi- added a working doctest demonstrating bold + named color output.parser::render- removed unnecessary.as_str()calls onStringreturn values.
0.6.0farben-core (cascade)
Added
- Specified resets -
[/bold],[/red],[/italic]etc. reset only the named style, leaving all other active styles intact. TagType::Resetnow takesOption<Box<TagType>>-Nonefor full reset[/],Some(tag)for partial reset.parser::rendernow maintains an active tag stack, re-emitting surviving styles after a partial reset.
Changed
TagType::Resetchanged from a unit variant toReset(Option<Box<TagType>>).- All existing
[/]full reset behavior is preserved viaReset(None).
Fixed
- Fixed a bug where
colorb!()did not exist when using thecompilefeature.
0.2.6farben / farben-macros
Changed
- Minor dependency update to
farben-core.
0.5.1farben
Changed
- Minor dependency update to
farben-core.
0.2.5farben-macros
Changed
- Minor dependency update to
farben-core.
0.4.2farben-core
Added
- Bright ANSI color variants (
bright-blackthroughbright-white).
0.5.0farben-core (cascade)
Added
- Added bugs.
Style::prefixfield - optional text prepended before the style's ANSI codes when applied.TagType::Prefix(String)variant - carries prefix text through the token pipeline to the renderer.set_prefix()- sets the prefix on an existing registry entry, panics if the style is not found.prefix!()macro - user-facing API for binding a text prefix to a named style.style_to_tags()now emitsTagType::Prefixas the first tag when a prefix is present.parser::render()now handlesTagType::Prefixby appending the text directly to output.formatdefault feature - gates logic forstyle!()andprefix!().
Changed
style_to_tags()no longer returns early onresetwhen a prefix is present; prefix is always emitted first.style!()is now gated to theformatfeature.
0.4.1farben-core
Fixed
- Bug where
prefix!()interfered with actual color styling.
0.2.4farben-macros
Changed
- Minor dependency update to
farben-core.
0.2.3farben-macros
Changed
- Minor dependency update to
farben-core.
0.4.0farben-core (cascade)
Added
Style::parse()- builds aStylefrom a farben markup string.Style::resetfield - whentrue, overrides all other style attributes with a full SGR reset.registrymodule - global style registry backed byOnceLock<Mutex<HashMap<String, Style>>>.insert_style()- inserts a named style into the global registry.search_registry()- looks up a named style from the global registry.style!()macro - user-facing API for defining custom named styles.style_to_tags()- converts aStyleinto aVec<TagType>for lexer expansion.- Custom tag resolution in
parse_part()- unknown tags now check the registry before returningInvalidTag. parse_part()return type changed fromResult<TagType, LexError>toResult<Vec<TagType>, LexError>to support style expansion.colorb!()bleeds at compile-time with thecolorb()runtime counterpart.
Changed
parse_tag()updated to flatten nestedVec<TagType>results fromparse_part().- All functions using
compilecan now benefit from compile-time processing instead of just validation.
Fixed
color!()now auto-resets.
0.2.2farben-macros
Added
- Dependency update to
farben-core. colorb!()macro that bleeds.
Fixed
color!()now auto-resets.
0.3.0farben-core
Added
Style::parse()- builds aStylefrom a farben markup string.Style::resetfield - whentrue, overrides all other style attributes with a full SGR reset.registrymodule - global style registry backed byOnceLock<Mutex<HashMap<String, Style>>>.insert_style()- inserts a named style into the global registry.search_registry()- looks up a named style from the global registry.style!()macro - user-facing API for defining custom named styles.style_to_tags()- converts aStyleinto aVec<TagType>for lexer expansion.- Custom tag resolution in
parse_part()- unknown tags now check the registry before returningInvalidTag. parse_part()return type changed fromResult<TagType, LexError>toResult<Vec<TagType>, LexError>to support style expansion.
Changed
parse_tag()updated to flatten nestedVec<TagType>results fromparse_part().
0.3.3farben
Added
cprintb!andcprintbln!for color-bleeding printing.
0.2.1farben-macros
Added
- 100% documentation coverage.
0.2.1farben-core
Added
- 100% documentation coverage.
0.3.2farben
Added
cprint!()- prints farben-colored markup to stdout without a newline, behaves likeprint!.cprintln!()- prints farben-colored markup to stdout with a trailing newline, behaves likeprintln!.- Both macros support format args and compile-time validation when the
compilefeature is enabled.
0.3.0farben
Added
color!()- compile-time markup processing via optionalcompilefeature flag.color_fmt!()- format args support with compile-time tag validation whencompileis enabled.validate_color!()- proc-macro that validates farben markup at compile time.color_runtime()- internal runtime fallback used bycolor_fmt!.bg:andfg:prefix support in color tags -[bg:red],[fg:white bg:blue].farben-coreandfarben-macrosas separate workspace crates.compilefeature flag for opt-in compile-time processing.
Changed
- Internal logic moved to
farben-core. color()replaced bycolor!proc-macro whencompilefeature is enabled.
0.2.0farben-core
Added
bg:andfg:prefix support for color tags.Groundfield added toTagType::Colorvariant.- Background color support in
encode_color_sgrandcolor_to_ansi. - New tests for background color parsing, tokenizing, and rendering.
Changed
TagType::Color(Color)restructured toTagType::Color { color: Color, ground: Ground }.
0.2.0farben-core (cascade)
Added
color!()- compile-time markup processing via optionalcompilefeature flag.color_fmt!()- format args support with compile-time tag validation.validate_color!()- proc-macro that validates farben markup at compile time, emitting the original string literal unchanged on success.color_runtime()- internal runtime fallback used bycolor_fmt!.farben-core- extracted shared logic crate containing lexer, parser, ANSI encoding, and error types.farben-macros- proc-macro crate powering compile-time processing.- Cargo workspace setup with
farben,farben-core, andfarben-macrosas members. compilefeature flag - opt-in compile-time processing viafarben-macros.
Changed
color()is now replaced by thecolor!proc-macro when thecompilefeature is enabled.- Internal logic extracted from
farbenintofarben-corefor shared use across crates.
0.1.0farben-core (cascade)
Added
color()- colorizes a string using markup-like syntax, panics on invalid markup.try_color()- same ascolor()but returnsResult<String, LexError>.- Named color tags:
[black],[red],[green],[yellow],[blue],[magenta],[cyan],[white]. - 256-color palette support via
[ansi(n)]. - 24-bit RGB support via
[rgb(r,g,b)]. - Emphasis tags:
[bold],[dim],[italic],[underline],[blink],[strikethrough]. - Multi-tag brackets:
[bold red],[italic rgb(255,0,0)]. - Reset tag
[/]to clear all active styles. - Escape sequence
\[to treat[as a literal character. LexErrorwith variantsUnclosedTag,InvalidTag,InvalidValue,InvalidArgumentCount.- Foreground and background color support via
Groundenum. - Automatic reset appended to all
color()andtry_color()output.