Giter Site home page Giter Site logo

d4_color's Introduction

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';

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.