搜尋套件、儲存庫與 APP 分類

套件詳情v3.0.0

console_color

用於終端機的256種顏色方便列舉。此程式庫為終端機的顏色代碼提供易辨識的名稱。

AndroidiOSLinuxmacOSWebWindows
近 30 天下載
3.3萬
喜歡數
3
Pub 分數
160

安裝套件

flutter pub add console_color

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

console_color 是一個 Flutter/Dart 套件,提供了一個包含 256 種終端色彩的便利列舉,為色彩代碼指派容易辨識的名稱。它透過允許開發者使用描述性的色彩名稱,而非原始 ANSI 碼,來簡化終端輸出格式化。非常適合用於跨多個平台的命令列應用程式中的記錄、除錯以及增強終端可讀性。

適用情境

  • 使用顏色增強控制台日誌
  • 透過彩色輸出調試應用程式
  • 改善基於終端的使用者介面
  • 自訂 CLI 工具輸出
  • 具有視覺層次的記錄

主要特色

  • 256 種預定義終端機顏色
  • 基於列舉的簡單 API
  • 可讀的顏色名稱
  • 跨平台支援
  • 與 print 語句的輕鬆整合

適合對象

  • 開發命令列工具的開發者
  • 團隊提升除錯可見性
  • 使用主控台輸出的教育專案
  • 需要終端著色的應用程式

使用建議

  • 僅限控制台輸出
  • 無執行時間顏色自定義
  • 依賴終端對 ANSI 顏色的支援
  • 不適用於GUI應用程式
  • 顏色在所有終端上的呈現可能不一致

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

1. About

The convenient enum of 256 colors for console. Console Color gives the color code for the console an easily recognizable name.

1.1. Introduction

1.1.1. Install Library

With Dart:

 dart pub add console_color

With Flutter:

 flutter pub add console_color
1.1.2. Import It
import 'package:console_color/console_color.dart';
1.1.3. Use library
import 'package:console_color/console_color.dart';

void main() {
  final color = ConsoleColor.cyan;
  print(color.name);
  print(color.code);

  for (final color in ConsoleColor.values) {
    print('name=${color.name}');
    print('code=${color.code}');
  }
}

1.2. License

Copyright (c) 2022, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.

1.3. More Information

Console Color was designed and implemented by Kato Shinya.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。

所在榜單