ansi_modifier 0.1.0 copy "ansi_modifier: ^0.1.0" to clipboard
ansi_modifier: ^0.1.0 copied to clipboard

Style strings for terminal output by adding, replacing, or removing ANSI modifiers.

example/README.md

Ansi Modifier - Example #

Dart

Usage #

The example below shows how the to add, modify, and clear Ansi modifiers.

import 'package:ansi_modifier/src/ansi.dart';

void main(List<String> args) {
  /// Create colorized strings.
  print('Create colorized strings:');
  final blue = 'blueberry'.style(Ansi.blue + Ansi.italic);
  final green = 'green apple'.style(Ansi.green);
  final blueGreen = blue +
      ' and ' +
      green.style(
        Ansi.bold,
        method: Replace.none,
      );
  print('$blue, $green, $blueGreen');

  /// Modify a previously colorized string.
  print('\nModify previously colorized strings:');

  /// Replace first modifier:
  final yellowGreen = blueGreen.style(Ansi.yellow + Ansi.bold + Ansi.underline,
      method: Replace.first);

  /// Replace all modifiers.
  final magenta =
      yellowGreen.style(Ansi.magenta, method: Replace.clearPrevious);

  /// Strip all Ansi modifiers.
  print('$yellowGreen, $magenta, ${magenta.clearStyle()}');
}

Features and bugs #

If some Ansi modifiers are missing please file a enhancement request at the issue tracker.

2
likes
0
pub points
26%
popularity

Publisher

verified publishersimphotonics.com

Style strings for terminal output by adding, replacing, or removing ANSI modifiers.

Repository (GitHub)
View/report issues

Topics

#ansi #terminal #console

License

unknown (license)

More

Packages that depend on ansi_modifier