tint 2.0.0-nullsafety.0 copy "tint: ^2.0.0-nullsafety.0" to clipboard
tint: ^2.0.0-nullsafety.0 copied to clipboard

outdated

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

Tint #

Tint is a library for terminal string styling extended upon Dart's String type.

Overview #

// tint.dart
import 'package:tint/tint.dart';

void main() {
  print('underlined blue text on white background'
      .underline()
      .blue()
      .onWhite());
}

Run it inside a terminal, and you'll get something this.

Installation #

Install the latest version of tint as a dependency as shown in pub.dev.

API Documentation #

For reference, all of the available APIs will be used as an example in the example/main.dart file.

Foreground Colors

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • brightBlack or gray or grey
  • brightRed
  • brightGreen
  • brightYellow
  • brightBlue
  • brightMagenta
  • brightCyan
  • brightWhite

Background Colors

  • onBlack
  • onRed
  • onGreen
  • onYellow
  • onBlue
  • onMagenta
  • onCyan
  • onWhite
  • onBrightBlack or onGray or onGrey
  • onBrightRed
  • onBrightGreen
  • onBrightYellow
  • onBrightBlue
  • onBrightMagenta
  • onBrightCyan
  • onBrightWhite

Attributes

  • bold
  • dim
  • italic
  • underline
  • blink
  • inverse
  • strikethrough

Dynamic Colors

  • rgb({int r, int g, int b})
  • onRgb({int r, int g, int b})

Utilities

  • reset (reset the color using ANSI code)
  • strip (remove all ANSI codes)

Alternatives #

Tint is an alternative to,

Acknowledgement #

Node's chalk is the library that inspired tint the most but the naming of the APIs such as onMagenta instead of bgMagenta and certain aspects of the library are mostly influenced by the console crate from Rust. The ansicolor and ansi_styles packages also provide the same functionality but with a different delivery for the usage. But I personally find extension methods syntactically more fun to use.

License #

MIT © Frenco Jobs

28
likes
0
pub points
99%
popularity

Publisher

verified publisherfrenco.dev

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on tint