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

パッケージ詳細v1.0.2

kandinsky

小さなカラーライブラリ。動的および固定のラジアルおよび線形グラデーションを作成し、RGB、HEX、ハue、HSL、CSSカラーを変換します。

30日間ダウンロード
10
いいね数
1
Pub ポイント
40

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

flutter pub add kandinsky

パッケージ概要

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

Kandinsky は、色の操作に使用できる軽量な Dart パッケージで、動的および固定の径方向および線形グラデーションを作成するためのツールを提供します。RGB、HEX、HSL、色相、CSS カラー形式間での変換をサポートしており、柔軟な色処理が必要なアプリケーションに最適です。シンプルさを重視して設計されており、オーバーヘッドを追加せずに Flutter プロジェクトにスムーズに統合できます。UIデザイン、テーマカスタマイズ、レスポンシブレイアウトにおけるグラデーション生成に特に役立ちます。

用途

  • UIでダイナミックなグラデーションを作成する
  • カラーフォーマット間の変換
  • テーマシステムの構築
  • カラーパレットの生成
  • ビジュアル要素のカスタマイズ

主な機能

  • ラジアルおよび線形のグラデーションをサポート
  • RGB、HEX、HSL、色相、およびCSSカラー変換
  • 軽量で依存関係が少ない
  • Flutterとの簡単な統合
  • 動的および固定グラデーション生成

適している対象

  • カラーユーティリティが必要なFlutter開発者
  • テーマを実装するUI/UXデザイナー
  • 動的なカラースキームを持つアプリ
  • グラデーションサポートを必要とするプロジェクト
  • シンプルな色変換が必要です

注意事項

  • プラットフォーム固有の機能なし
  • 色の操作に限定
  • 組み込みのカラーピッカーなし
  • 複雑な画像処理には適していません
  • 基本的な使用法を超える最小限のドキュメント

元の README

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

kandinsky-dart

Dart codecov Pub Version

A Dart ported version of francisrstokes/kandinsky-js

Create dymanic and fixed gradients, convert from/to rgb, hue, hex, hsl and css colors.

Documentation

Pub dev package: https://pub.dev/packages/kandinsky

Online documentation: https://renanborgez.github.io/kandinsky-dart/

Install

  1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  kandinsky: any
  1. Install it

You can install packages from the command line:

# with pub:
$ pub get

# with Flutter:
$ flutter pub get

Usage

A simple usage example:

import 'package:kandinsky/kandinsky.dart' as kandinsky;

main() {
  var darkenHexColor = kandinsky.darkenHex(0.5, '#6699CC');
  print('my darken hex color: ${darkenHexColor}');

  var lightenHexColor = kandinsky.lightenHex(0.5, '#06795C');
  print('my lighten hex color: ${lightenHexColor}');

  var darkenRgbColor = kandinsky.darkenRgb(0.5, [180, 40, 20]);
  print('my darken rgb color: ${darkenRgbColor}');

  var lightenRgbColor = kandinsky.lightenRgb(0.5, [155, 90, 60]);
  print('my lighten rgb color: ${lightenRgbColor}');

  var myDynamicGradient = kandinsky.linearGradient(10, [255, 100, 50], [30, 200, 255]);
  print('my gradient with 10 colors: ${myDynamicGradient}');

  var myHslColorFromRgb = kandinsky.rgb2hsl([255, 255, 255]);
  print('my hsl color from a rgb color: ${myHslColorFromRgb}');
}

API

You can check the online version here: http://kandinsky-dart.borges.ninja/

rgb2hsl(rgbArray)

returns a hsl array


List<num> rgb2hsl(List<num> color)

hsl2rgb(hslArray)

returns an rgb array


List<num> hsl2rgb(List<num> color)

hex2rgb(hexString)

returns an rgb array


List<num> hex2rgb(String hex)

rgb2hex(rgbArray)

returns a hex string


String rgb2hex(List<num> rgb)

hex2hsl(hexString)

returns a hsl array


List<num> hex2hsl(String hex)

hsl2hex(hslArray)

returns a hex string


String hsl2hex(List<num> color)

darkenRgb(amount, rgbArray)

returns a darkened rgb array. amount is a value in the range [0, 1]


List<num> darkenRgb(num amount, List<num> rgb)

lightenRgb(amount, rgbArray)

returns a lightened rgb array. amount is a value in the range [0, 1]


List<num> lightenRgb(num amount, List<num> rgb)

darkenHsl(amount, hslArray)

returns a darkened hsl array. amount is a value in the range [0, 1]


List<num> darkenHsl(num amount, List<num> color)

lightenHsl(amount, hslArray)

returns a lightened hsl array. amount is a value in the range [0, 1]


List<num> lightenHsl(num amount, List<num> color)

lightenHex(amount, hexString)

returns a lightened hex string. amount is a value in the range [0, 1]


String lightenHex(num amount, String hex)

darkenHex(amount, hexString)

returns a darkened hex string. amount is a value in the range [0, 1]


String darkenHex(num amount, String hex)

lerp3(t, c1, c2)

returns a Vector3 colour somewhere between c1 and c2. t is the "time" value in the range [0, 1]


List<num> lerp3(num t, List<num> color1, List<num> color2)

linearGradient(n, c1, c2)

returns an length n array of Vector3 colours. colours are evenly spaced between c1 and c2.


List<List<num>> linearGradient(num n, List<num> color1, List<num> color2)

gradient(easeFn, n, c1, c2)

returns an length n array of Vector3 colours. colours are between color1 and color2, and are spaced according to the easing function easeFn.


List<List<num>> gradient(Function ease, int n, List<num> color1, List<num> color2)

multiGradient(n, [col1, col3, ..., colN])

returns a length n array of Vector3 colours. colours are the ones formed from the linearGradient(n/(numColours-1), col1, col2) for all colours col1, col2, ..., colN


List<List<num>> multiGradient(num n, List<List<num>> colors)

rLinearGradient(n, c1, c2)

returns a rounded, length n array of Vector3 colours. colours are evenly spaced between color1 and color2.


List<List<num>> rLinearGradient(num n, List<num> color1, List<num> color2)

rGradient(easeFn, n, c1, c2)

returns a rounded, length n array of Vector3 colours. colours are between color1 and color2, and are spaced according to the easing function easeFn.


List<List<num>> rGradient(Function ease, num n, List<num> color1, List<num> color2)

rMultiGradient(n, [col1, col3, ..., colN])

returns a rounded, length n array of Vector3 colours. colours are the ones formed from the linearGradient(n/(numColours-1), col1, col2) for all colours col1, col2, ..., colN


List<List<num>> rMultiGradient(num n, List<List<num>> colors)

complimentHex(n, hexString)

returns an length n array of hex strings. The 0th color is the same as the input hexString, while the others are colours corresponding to an eve turn around the colour wheel. If n is 3 for example, the two other colours would represent a 1/3 and 2/3 rotation of the colour wheel.


List<String> complimentHex(num n, String hex)

complimentHsl(n, hsl)

returns an length n array of hsl Vector3. The 0th color is the same as the input hsl, while the others are colours corresponding to an eve turn around the colour wheel. If n is 3 for example, the two other colours would represent a 1/3 and 2/3 rotation of the colour wheel.


List<List<num>> complimentHsl(num n, List<num> color)

complimentRgb(n, rgb)

returns an length n array of rgb Vector3. The 0th color is the same as the input rgb, while the others are colours corresponding to an eve turn around the colour wheel. If n is 3 for example, the two other colours would represent a 1/3 and 2/3 rotation of the colour wheel.


List<List<num>> complimentRgb(num n, List<num> color)

rgb2css(alpha, rgb)

returns an rgba css string like rgba(255, 255, 255, 1) from the rgb color and alpha value


String rgb2css(num alpha, List<num> color)

hsl2css(alpha, hsl)

returns an hsl css string like hsl(222, 50%, 75%, 0.6) from the hsl color and alpha value


String hsl2css(num alpha, List<num> hsl)

color2hue(num p, num q, num t)

returns a saturation of a specific color value


num color2hue(num colorValue, num shading, num tint)

Features and bugs

Please file feature requests and bugs at the issue tracker.

License

MIT

カテゴリー

ソースリポジトリ

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

データはまだありません。