Git Product home page Git Product logo

tint's Introduction

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.


License

MIT © Frenco Jobs

tint's People

Contributors

frencojobs avatar rithviknishad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.