Skip to main content

Crate farben_macros

Crate farben_macros 

Source
Expand description

Procedural macros for the Farben terminal styling library.

Provides compile-time processing of farben markup, baking the final ANSI-escaped strings directly into the binary with zero runtime overhead. Also provides compile-time format string splitting via cformat and cformatb. All macros in this crate are re-exported through farben and should not be used directly in most cases.

§Macros

  • color! – parse and render markup at compile time, returns a FarbenStr
  • colorb! – same as color! but without a trailing reset
  • cformat! – compile-time split of markup format strings with runtime args
  • cformatb! – bleed variant of cformat!
  • validate_color! – validates markup at compile time, returns the original string

Macros§

cformat
Compiles a farben markup format string into an inlined String-building block.
cformatb
Like cformat! but omits the trailing SGR reset.
color
Parses and colorizes a farben markup string at compile time.
colorb
Parses and colorizes a farben markup string at compile time, without appending a trailing SGR reset.
compile_cprint
Proc-macro backend for the compile-variant ($fmt:literal) arms of cprint!, cprintln!, cprintb!, etc.
compile_cprintb
Proc-macro backend for the compile-variant ($fmt:literal) arms of the bleed variants (cprintb!, cprintbln!, etc.). Same logic as compile_cprint but omits the trailing SGR reset.
validate_color
Validates farben markup at compile time and returns the original string literal unchanged.