FLUTTER ECOSYSTEM

frencojobs/tint

Dart용 터미널 문자열 스타일 라이브러리입니다.

티ント 프로젝트 이미지
Stars
31
Forks
2
최근 푸시(UTC)
2023. 2. 4.
프로젝트 상태
활성
Frenco GitHub avatar
GITHUB User

Frenco ↗

언어Dart

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 2 개
  • lint개발 의존성^2.0.1
  • test개발 의존성^1.22.2

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

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.

https://i.imgur.com/raO2b4J.png

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.