Creates a new StyleBuilder instance.
Whether to apply colors to output
Initial styles to apply (used internally for chaining)
Apply bright magenta background color.
New builder with bright magenta background
Apply grey background color (alias for bgGray).
New builder with grey background
Apply reverse text style (swap foreground and background colors).
New builder with reverse style
Gets the current style stack.
Useful for debugging or introspection.
Array of accumulated styles
Checks if colors are enabled for this builder.
Whether colors are enabled
Static
clearStatic
createCreates a new StyleBuilder with specified color setting.
Useful for creating conditional styling based on environment.
Whether to use colors
New StyleBuilder instance
StyleBuilder provides a chainable API for building styled strings.
Similar to popular libraries like Chalk, it allows intuitive chaining of color and style modifiers. The builder uses a Proxy-based approach to provide dynamic property access and efficient caching of style combinations.
StyleBuilder
Example