Git Product home page Git Product logo

Comments (4)

jheer avatar jheer commented on May 4, 2024

Commit e01e34f adds support for direct addressing of specific color channels in one of RGB, HSL, or LAB color space. Combined with appropriate scales, this may let you do the color encodings you describe in a principled fashion.

Here's an example of setting LAB color values on a per-channel basis. L ranges from 0-100, while A and B channels range from (roughly) -100 to 100.

"update": {
   "fill": {
    "l": {"scale":"y", "field":"data.y", "mult":0.5},
    "a": {"scale":"x", "field":"data.x", "offset":-100},
    "b": {"value": 0}
  }
}

Here's an example for HSL (Hue, Saturation, Lightness). Hue ranges over 0-360 (higher values are taken modulo 360), saturation from 0-1.0 and lightness from 0-1.0.

"update": {
   "fill": {
    "h": {"scale":"y", "field":"data.y"},
    "s": {"scale":"x", "field":"data.x", "mult":0.01},
    "l": {"value": 0.5}
  }
}

RGB works similarly, with each channel ranging from 0-255. Underneath the hood, standard d3 color objects are used for each of these color spaces.

from vega.

hadley avatar hadley commented on May 4, 2024

Awesome. Any chance of a hcl (polar-LUV) space?

from vega.

jheer avatar jheer commented on May 4, 2024

Done: cdd1b98. Just use "h", "c", and "l" as your keys.

from vega.

hadley avatar hadley commented on May 4, 2024

Awesome - thanks!

from vega.

Related Issues (20)

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.