A Ruby gem for terminal output styling with an intuitive, chainable API that avoids monkey-patching.
Pastel is a Ruby library for styling terminal output with colors and text effects. It solves the problem of creating readable, visually distinct command-line interfaces by providing a clean API to apply ANSI colors without monkey-patching core classes. It integrates with the TTY toolkit and works across all terminal emulators.
Ruby developers building command-line applications, CLI tools, or scripts that require colored output for better user experience or debugging.
Developers choose Pastel for its intuitive, chainable API that avoids global modifications, its performance, and its reliability across terminals with automatic color support detection.
Terminal output styling with intuitive and clean API.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Allows intuitive style composition with methods like `pastel.red.on_green.bold('text')`, making code readable and reducing verbosity, as demonstrated in the README examples.
Works independently without modifying core Ruby classes like String, ensuring compatibility across environments and avoiding conflicts in larger codebases, a key philosophy highlighted in the README.
Handles nested color sequences intelligently within strings and blocks, automatically managing escape sequences to prevent conflicts, as shown with examples using concatenation and block syntax.
Designed for speed in generating styled strings, which is crucial for CLI applications with frequent output, as noted in the features section.
Supports only 16 basic colors and 8 styles, lacking extended color modes like 256-color or truecolor that some modern terminals support, as stated in the 'Supported Colors' section.
Does not automatically print colored strings; developers must handle output themselves, which can add boilerplate code compared to libraries that integrate printing directly.
The command-line interface requires installing an additional gem (`pastel-cli`), adding overhead for simple scripting needs where a built-in tool would be more convenient.