ansicolor
2.0.3, released 2 years ago by mcdole.org
An xterm-256 color support library for changing terminal text colors and backgrounds.
What it does
Provides AnsiPen to add ANSI color codes to terminal log messages and text output. Supports setting foreground and background colors easily and globally disabling colors for production.
AI-written summary of version 2.0.3, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to colorize terminal logs or command-line outputs in Dart
- You need xterm-256 color support for CLI tools
Skip it when
- You are building a Flutter GUI application rather than a CLI tool
- You need a full-featured logging framework with severity levels and formatting
Strengths
- Simple API using AnsiPen
- Supports xterm-256 colors and RGB coloring
- Easy global disabling for production environments
Weaknesses
- Relies on stdio to detect ANSI support which can sometimes be wrong
- Limited to adding ANSI color codes
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
No dependencies or complex setup required.
AnsiPen pen = AnsiPen()..white(bold: true);
print(pen("Bright white foreground") + " this text is default fg/bg");Alternatives
Packages that do the same job and could replace ansicolor.
- logger
If you need a complete logging solution with pretty printing and log levels rather than just raw ANSI color pens.
83Compare - mason_logger
If you are building complex CLI tools and need advanced logging, progress indicators, and standard CLI styling.
90Compare
Works with
Packages commonly used together with ansicolor: ones it builds on, ones built on it, and its own family.
- flutter_native_splashBuilt on ansicolorAutomatically generates native iOS, Android, and Web splash screens.
- sentry_dart_pluginBuilt on ansicolorUploads debug symbols and source maps to Sentry for server-side symbolication.
- lean_builderBuilt on ansicolorLean Builder: a fast, efficient Dart build system for code generation
- talker_loggerBuilt on ansicolorLightweight, customizable logger with filters, formatters and log levels
- dart_code_linterBuilt on ansicolorA software analytics and static analysis tool for checking code metrics, lint rules, and unused code.
- dart_mappable_builderBuilt on ansicolorBuilder that generates dart_mappable code for JSON serialization and data classes.
- spiderBuilt on ansicolorA Dart command-line tool for generating type-safe Dart references for assets.
- ispectifyBuilt on ansicolorPure-Dart structured logging, tracing, filtering, history, observers, export, and redaction core.