color_models
2.0.0, released 2 years ago by jamesalex.dev
Provides Dart models for many color spaces and conversion between them.
WASM-ready
What it does
Defines classes for CMYK, HSI, HSL, HSP, HSB, LAB, Oklab, RGB, and XYZ color spaces. Includes methods to convert, adjust, interpolate, and augment colors.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need precise color manipulation across multiple color spaces
- You want to convert colors without relying on Flutter's Color class
- You need utilities for color interpolation and palette generation
Skip it when
- You only need basic Flutter Color support
- You require a UI widget library for colors
Strengths
- Wide range of color space support
- Conversion methods are comprehensive
- Provides interpolation and palette augmentation
Weaknesses
- No Flutter widgets, only data models
- May be overkill for simple color needs
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
import 'package:color_models/color_models.dart';
final rgb = RgbColor(255, 0, 0);
final hsl = rgb.toHslColor();
print(hsl); // HslColor(0.0, 100.0, 50.0)Alternatives
Packages that do the same job and could replace color_models.
- string_to_color
Convert strings to colors, hex strings, or hex integers in Dart and Flutter.
42Compare - intersperse
Insert a given element between each element of an Iterable or List.
50Compare - markdown_quill
Convert between quill delta format and markdown.
48Compare - hex
Provides simple HEX.encode and HEX.decode functions for converting between byte lists and hexadecimal strings.
47Compare