Last updated:
0 purchases
mansion
Mansion #
A stately library for crafting and deciphering ANSI escape codes.
Styling text is ~1-line with lots of possibilities:
print('Hello World'.style(Style.foreground(Color.red), Style.bold));
copied to clipboard
When you're ready, graduate to a full-featured package for more control:
stdout.writeAnsiAll([
// Sets the cursor position to the top-left corner.
CursorPosition.reset,
// Clear the screen.
Clear.all,
// Set a bunch of styles.
SetStyles(
Style.bold,
Style.underline,
Style.italic,
Style.foreground(Color.red),
Style.background(Color.green),
),
// Print some text.
Print('Hello, World!'),
// Reset all styles.
SetStyles.reset,
// Move the cursor to the next line.
AsciiControl.lineFeed,
]);
copied to clipboard
Includes a full-featured ANSI escape decoder for writing terminal emulators!
Features #
Cross-platform support for most popular ANSI escape codes.
Fully tested and documented with examples and explanations.
Walkthroughs for common use-cases and best practices.
Intuitive API using the latest Dart features.
Practically zero dependencies (only meta for annotations).
Importantly, mansion is not a general purpose terminal library; it does not
provide terminal emulation, any real input handling other than event code
parsing, anything to do with FFI or native code, or any other terminal-related
functionality.
Build on top of mansion to create your own terminal libraries, or use it to
style text in your command-line applications.
Contributing #
To run the tests, run:
dart test
copied to clipboard
To check code coverage locally, run:
dart tool/coverage.dart
copied to clipboard
To preview dartdoc output locally, run:
dart tool/dartdoc.dart
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.