Skip to content

luizbarboza/d4_color

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dart CI pub package package publisher

Color spaces! RGB, HSL, Cubehelix, CIELAB, and more.

This package provides representations for various color spaces, allowing specification, conversion and manipulation. (Also see d3_interpolate for color interpolation.)

For example, take the color named “steelblue”:

final c = Color.parse("steelblue"); // {r: 70, g: 130, b: 180, opacity: 1}

Let’s try converting it to HSL:

final c = Hsl.from("steelblue"); // {h: 207.27…, s: 0.44, l: 0.4902…, opacity: 1}

Now rotate the hue by 90°, bump up the saturation, and format as a string for CSS:

c.h += 90;
c.s += 0.2;
c.toString(); // rgb(198, 45, 205)

To fade the color slightly:

c.opacity = 0.8;
c.toString(); // rgba(198, 45, 205, 0.8)

In addition to the ubiquitous and machine-friendly RGB and HSL color space, d4_color supports color spaces that are designed for humans:

  • CIELAB (a.k.a. “Lab”)
  • CIELChab (a.k.a. “LCh” or “HCL”)
  • Dave Green’s Cubehelix

Cubehelix features monotonic lightness, while CIELAB and its polar form CIELChab are perceptually uniform. export 'src/d4_color.dart';

About

Color spaces! RGB, HSL, Cubehelix, CIELAB, and more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages