v0.0.2
colorify
一个简单的 Flutter 包,可根据给定的动态种子生成确定性的随机颜色。
1喜欢 24近 30 天下载160Pub 分数
AndroidiOSWebmacOSWindowsLinux
🎨 一个简单的 Flutter 包,可根据给定的动态种子生成确定性的随机颜色。
{"sdk":"flutter"}^3.0.6{"sdk":"flutter"}^4.0.0以下为英文项目原文快照,最新内容请访问 GitHub。
An extremely simple Flutter package that deterministically converts arbitrary dynamic input into a Color. Published mainly for personal use to avoid reinventing the wheel in my projects.
import 'package:colorify/colorify.dart' as c;
import 'package:flutter/material.dart';
void main() {
final input = 'example-seed';
final color = c.colorify(input);
print(color); // Outputs a Color object deterministically derived from 'example-seed'.
}
You can specify the type of colors generated by using the ColorType enum:
ColorType.all: Generates colors from the full spectrum.ColorType.brights: Generates bright and vibrant colors.Example:
import 'package:colorify/colorify.dart' as c;
import 'package:flutter/material.dart';
void main() {
final input = 'example-seed';
// Generate a color from the full spectrum
final allColors = c.colorify(input, colorType: c.ColorType.all);
// Generate a bright color
final brightColor = c.colorify(input, colorType: c.ColorType.brights);
}