Search packages, repositories and app categories

tint cover
Package detailsv2.0.1

tint

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

AndroidiOSWebmacOSWindowsLinux
30-day downloads
506K
Likes
41
Pub points
150

Install package

flutter pub add tint

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Tint is a Flutter/Dart package that adds terminal string styling capabilities as an extension to the String class. It enables developers to easily apply colors, styles, and formatting to text output in console or CLI applications. With simple syntax, users can highlight logs, debug messages, or interactive prompts with ANSI escape codes under the hood. The library supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux, making it ideal for cross-platform command-line tools. Tint simplifies terminal aesthetics without requiring manual handling of escape sequences.

Use cases

  • Console logging with color
  • CLI user interface enhancements
  • Debug message highlighting
  • Terminal-based dashboards
  • Cross-platform terminal output
  • Interactive command-line apps

Key features

  • String extension for styling
  • ANSI escape code support
  • Platform-agnostic
  • Simple API
  • Color and style customization
  • Built-in presets

Suitable for

  • Developers building CLI tools
  • Flutter apps with console output
  • Logging and debugging utilities
  • Cross-platform terminal applications
  • Educational or demo projects

Considerations

  • Limited to terminal output
  • No runtime styling changes
  • Depends on terminal support
  • Not for UI rendering
  • Minimal documentation
  • No theme system

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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());
}

The snippet will produce an underlined blue text on a white background once you run it inside a terminal.

The example at example/main.dart file contains examples for all APIs. Try running it 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.

Categories

Source repository

Projects using this package