tint 2.0.0 copy "tint: ^2.0.0" to clipboard
tint: ^2.0.0 copied to clipboard

A library for terminal string styling as an extension on `String`.

example/main.dart

import 'dart:io' show stdout;
import 'package:tint/tint.dart';

void main() {
  // Attributes
  final bold = 'bold'.bold();
  final dim = 'dim'.dim();
  final italic = 'italic'.italic();
  final underline = 'underline'.underline();
  final blink = 'blink'.blink();
  final inverse = 'inverse'.inverse();
  final hidden = 'hidden'.hidden();
  final strikethrough = 'strikethrough'.strikethrough();
  // Foreground Colors
  final black = 'black'.black().onWhite();
  final red = 'red'.red();
  final green = 'green'.green();
  final yellow = 'yellow'.yellow();
  final blue = 'blue'.blue();
  final magenta = 'magenta'.magenta();
  final cyan = 'cyan'.cyan();
  final white = 'white'.white();
  final gray = 'gray'.gray();
  // Background Colors
  final onBlack = 'onBlack'.white().onBlack();
  final onRed = 'onRed'.onRed();
  final onGreen = 'onGreen'.onGreen();
  final onYellow = 'onYellow'.black().onYellow();
  final onBlue = 'onBlue'.onBlue();
  final onMagenta = 'onMagenta'.onMagenta();
  final onCyan = 'onCyan'.onCyan();
  final onWhite = 'onWhite'.black().onWhite();
  final onGray = 'onGray'.onGray();

  final all = [
    [
      bold,
      dim,
      italic,
      underline,
      blink,
      inverse,
      hidden,
      strikethrough,
    ],
    [
      black,
      red,
      green,
      yellow,
      blue,
      magenta,
      cyan,
      white,
      gray,
    ],
    [
      onBlack,
      onRed,
      onGreen,
      onYellow,
      onBlue,
      onMagenta,
      onCyan,
      onWhite,
      onGray
    ]
  ];

  stdout.writeln();
  stdout.writeln(all.map((x) => x.join(' ')).join('\n'));
  // ^ add `.strip()` after join to remove all formattings
  stdout.writeln();
}
39
likes
160
pub points
99%
popularity

Publisher

verified publisherfrenco.dev

A library for terminal string styling as an extension on `String`.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on tint