パッケージ、リポジトリ、アプリカテゴリを検索

ansicolor のカバー
パッケージ詳細v2.0.3

ansicolor

ターミナルログに色を加えたいですか?`ansicolor` は xterm-256 カラー対応ライブラリで、テキストの前面および背面の色を変更できます。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
327万
いいね数
171
Pub ポイント
160

パッケージをインストール

flutter pub add ansicolor

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

ansicolor は、ターミナル出力に xterm-256 色のサポートを提供する Dart ライブラリであり、開発者がコンソールログ内のテキストの前景色および背景色をカスタマイズできるようにします。複数のプラットフォームで Flutter アプリケーションとシームレスに統合され、デバッグの可視性とログの読みやすさを向上させます。外部ツールに頼らずにターミナル出力に視覚的な区別を加えたい開発者にとって理想的です。シンプルな構文により、ターミナル内で幅広い色とフォーマットオプションを直接サポートしています。

用途

  • ターミナルデバッグ出力を強化する
  • ログメッセージの色分け
  • CLIツールの可読性の向上
  • コンソールアプリケーションに視覚フィードバックを追加する
  • コマンドラインインターフェースの外観をカスタマイズする

主な機能

  • xterm-256 色をサポートしています
  • 使いやすい色の書式設定
  • クロスプラットフォーム端末サポート
  • 前面/背景色のシンプルなAPI
  • 軽量で依存関係なし

適している対象

  • CLI ツールを開発する開発者
  • コンソールログ記録付きのFlutterアプリ
  • 視覚的な手がかりを必要とするデバッグ環境
  • チームがログの明確さを向上させています
  • 教育的またはチュートリアルプロジェクト

注意事項

  • 端末出力のみに制限
  • UIレンダリングには適していません
  • ANSIカラーをサポートするターミナルが必要です
  • すべてのターミナルで一貫してレンダリングされない可能性があります
  • コード以外のランタイムカラーのカスタマイズはできません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

ANSI / Xterm 256 color library for Dart

Feel like you're missing some color in your terminal programs? Use AnsiPen to add ANSI color codes to your log messages.

Easy to disable for production, just set color_disabled = true and all codes will be empty - no re-writing debug messages.

Note: color_disabled is a global variable for all pen colors.

Example

Note: Be mindful of contrasting colors. If you set "bright white" foreground and don't adjust the background, you'll have a bad time with lighter terminals.

Foreground to bright white with default background:

AnsiPen pen = AnsiPen()..white(bold: true);
print(pen("Bright white foreground") + " this text is default fg/bg");

Background as a peach, foreground as white:

AnsiPen pen = AnsiPen()..white()..rgb(r: 1.0, g: 0.8, b: 0.2, bg: true);
print(pen("White foreground with a peach background"));

Note

If color isn't working for you; try setting ansiColorDisabled = false;. We're relying on the stdio object to inform us of ANSI terminal support. Sometimes this is wrong.

Prior versions of this library just turned on color by default.

Rainbow Demo

If you want a specific color, you can call the xterm() with the index listed in the rainbow below. To show the rainbow on your own terminal, pub run examples/ansicolor.dart

alt tag

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

ランキング