Skip to main content

oklch_dart 1.1.0 copy "oklch_dart: ^1.1.0" to clipboard
oklch_dart: ^1.1.0 copied to clipboard

Dart-only implementation of OKLCH color space

oklch_dart #

Pure Dart implementation of the OKLCH and OKLab color spaces, with no Flutter SDK dependency. Use it in Dart CLI tools, servers and other Dart applications. For Flutter color extensions and the color picker widget, use the oklch package instead.

Installation #

dart pub add oklch_dart

Usage #

import 'package:oklch_dart/oklch_dart.dart';

void main() {
  const red = ColorData.fromARGB(0xFFFF0000);
  final color = OKLCHColor.fromColorData(red);
  print(color.rgbHex); // #ff0000

  final mixed = OKLCHColor.mix(color, OKLCHColor.white, 0.5);
  print(mixed.rgbHex);
  final rgb = mixed.toColorData();
  print(rgb);
}

ColorData stores normalized RGBA channels. OKLCHColor supports conversion, mixing and opacity changes; OKLABColor provides OKLab conversion. Hue is in degrees.

License #

Apache License 2.0; see LICENSE.

0
likes
140
points
0
downloads

Documentation

API reference

Publisher

verified publisherturingdeal.com

Weekly Downloads

Dart-only implementation of OKLCH color space

Homepage
Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

More

Packages that depend on oklch_dart