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

パッケージ詳細v3.0.0

color

さまざまなカラースペースで色の作成、変換、編集、比較に使用できる、Color クラスを公開するシンプルなDartパッケージです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
82.9万
いいね数
36
Pub ポイント
130

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

flutter pub add color

パッケージ概要

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

color パッケージは、複数のカラースペースで色の作成、操作、比較を行うための包括的な Color クラスを提供する軽量な Dart ライブラリです。色変換、ブレンド、比較などの操作をサポートしており、正確な色処理が必要なアプリケーションに最適です。シンプルさとパフォーマンスを重視して設計されており、すべての主要プラットフォームでの Flutter プロジェクトにシームレスに統合できます。デザインツール、テーマシステム、ビジュアルアプリケーションなど、正確な色管理が不可欠な分野で特に有用です。

用途

  • テーマのカスタマイズ
  • カラーパレットの生成
  • ビジュアルデザインツール
  • 画像処理
  • UIプロトタイピング
  • クロスプラットフォームの色の整合性

主な機能

  • 複数の色空間をサポートしています
  • カラーコンバージョンユーティリティ
  • 色の比較方法
  • 使いやすい API
  • Platform-agnostic
  • 拡張可能な色操作

適している対象

  • Flutter開発者
  • デザインシステム作成者
  • UI/UXデザイナー
  • 色に敏感なアプリケーション
  • クロスプラットフォームアプリ
  • プロトタイピングツール

注意事項

  • 基本的な色操作に限定
  • 組み込みのカラーピッカーUIがありません
  • 手動でのカラースペース管理が必要
  • 複雑な画像分析に最適化されていません
  • コードコメント以外の最小限のドキュメント
  • 実行時カラー検証なし

元の README

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

Color

A simple Dart package exposing a Color class which can be used to create, convert, and compare colors.

Installation

  1. Add this to your package's pubspec.yaml file:
dependencies:
  color: any
  1. Get the package using your IDE's GUI or via command line with
$ pub get
  1. Import the color.dart file in your app
import 'package:color/color.dart';

Usage

Color objects can be constructed using any of a few available constructors.

To create a color from rgb values, call

Color rgbColor = new Color.rgb(192, 255, 238);
RgbColor rgbColor = new RgbColor(192, 255, 238);

Alternatively, a color can be created directly in a number of other color spaces.

RgbColor rgb = new RgbColor(192, 255, 238);
HexColor hex = new HexColor('c0ffee');
HslColor hsl = new HslColor(163.8, 100, 87.6);
XyzColor xyz = new XyzColor(72.931, 88.9, 94.204);
CielabColor cielab = new CielabColor(95.538, -23.02, 1.732);

Colors are immutable, and can be created using const constructors.

RgbColor rgb = const RgbColor(192, 255, 238);

Colors can be created directly from CSS3 color names.

RgbColor black = new RgbColor.name('black'); //factory constructor that returns a const RgbColor
RgbColor white = RgbColor.namedColors['black']; //directly reference the const RgbColor without the factory

Colors implementing the CssColorSpace interface can output a css string representation.

RgbColor rgb = new RgbColor(192, 255, 238);
HexColor hex = new HexColor('c0ffee');
HslColor hsl = new HslColor(163.8, 100, 87.6);
assert(rgb is CssColorSpace, true);
assert(hex is CssColorSpace, true);
assert(hsl is CssColorSpace, true);
print(rgb.toCssString()); //rgb(192, 255, 238)
print(hex.toCssString()); //#c0ffee
print(hsl.toCssString()); //hsl(163.8, 100.0%, 87.6%)

Colors can be compared using the == operator, which will evaluate to true if the two colors share identical rgb values after being rounded to integers.

assert(new Color.hex('c0ffee') == new Color.hex('c0ffee'));
assert(new Color.rgb('192, 255, 238') == new Color.hex('c0ffee'));

Colors can be converted from one color space to another by calling the appropriate toXXXColor method on them.

HslColor hsl = new RgbColor(192, 255, 238).toHslColor();

Colors can be altered using a ColorFilter, which will return a new color in the same color space as the input color with that filter applied to it.

RgbColor grey = ColorFilter.greyscale(new RgbColor(192, 255, 238));
HslColor sepia = ColorFilter.sepia(new HslColor(163.8, 100, 87.6));

カテゴリー

ソースリポジトリ

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