mansion 0.1.0+1 copy "mansion: ^0.1.0+1" to clipboard
mansion: ^0.1.0+1 copied to clipboard

A stately library for crafting and deciphering ANSI escape codes.

mansion #

A stately library for crafting and deciphering ANSI escape codes.

✅ Health 🚀 Release 📝 Docs ♻️ Maintenance
Build status for package/mansion Pub version for package/mansion Dart documentation for package/mansion GitHub Issues for package/mansion

Demo

Styling text is ~1-line with lots of possibilities:

print('Hello World'.style(Style.foreground(Color.red), Style.bold));

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,
]);

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 #

We welcome contributions to this package!

Please file an issue before contributing larger changes.

This package uses repository specific tooling to enforce formatting, static analysis, and testing. Please run the following commands locally before submitting a pull request:

  • ./dev.sh --packages packages/mansion check
  • ./dev.sh --packages packages/mansion test
5
likes
160
points
156
downloads

Publisher

verified publisherlurey.dev

Weekly Downloads

A stately library for crafting and deciphering ANSI escape codes.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

meta

More

Packages that depend on mansion