Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LAB color space support. #183

Closed
wants to merge 10 commits into from
Closed

Add LAB color space support. #183

wants to merge 10 commits into from

Conversation

mbostock
Copy link
Member

No description provided.

@jheer
Copy link
Contributor

jheer commented Jun 22, 2011

Note that I have since pushed a small update to the color library that fixes a typo bug in CIE76 and CIE94 color difference formulas.

@mbostock
Copy link
Member Author

mbostock commented Jul 2, 2011

I discovered that you get a major performance boost in interactivity if you use style rather than attr to set the fill color, and you don't use a tooltip. In section.js:

function refresh() {
  svg.selectAll("g").selectAll("rect")
    .data(cross(b))
    .style("fill", color);
}

@jrus
Copy link

jrus commented Sep 7, 2011

This may be useful:

https://github.com/jrus/chromatist

@mbostock
Copy link
Member Author

mbostock commented Sep 8, 2011

Thanks for sharing, @jrus.

@jheer
Copy link
Contributor

jheer commented Sep 8, 2011

Nice, @jrus. I appreciate Chromatist's inclusion of CIECAM02. I've considered implementing this also, but haven't had the time. Do you plan to also include other color difference calculations (e.g., CIEDE2000)? If so, I found a collection of test cases that you might find helpful; they are in my (currently out of date) D3 repo clone.

That said, one other thing I do like about my LAB color conversion code is that it follows the model of D3's existing color support, for example enabling color objects to plug right in to attribute definitions.

@jrus
Copy link

jrus commented Sep 8, 2011

Yeah, I’m not suggesting you rely on my code directly, necessarily. Only that having existing an existing CIECAM02 implementation might be helpful, if you’re interested in making one.

I do plan on adding things like color difference calculations, though I don't have too much use for them myself. (For what it’s worth, CIEDE2000 also seems to me to be a dramatically more complex model than is supported by any data or data + theory).

I also want to add a Munsell lookup table & some kind of interpolation code for that, a lookup of ISCC–NBS color names for a given Munsell color, some more chromatic adaptation routines, and so forth.

The immediate use case for my CIECAM02 implementation: I need to do quite a bit more work on this thing, but it's at least vaguely interesting in this state:
http://www.hcs.harvard.edu/~jrus/colortheory/javascript/colorpicker.html

I think D3 (and protovis before) is totally great, so many thanks to you fellows. I've been meaning to write some sort of philosophical blog essays (on a not-yet-existing blog) for some time about them, as grokking protovis took me substantially longer than it would have if I’d been able to see a more conceptual overview explaining the ideas behind the abstractions in addition to just the API reference and a bunch of examples. It looks like the D3 story is a bit better there, but of course the more the merrier when it comes to explanations of things. I'll let you know if I do – plenty of other projects too. :)

Jeff: your "color spaces" example is pretty silly, if I do say so, rendering every pixel as its own DOM square. Even if just rendering pixels in canvas image data arrays wouldn't show off D3 as much, it'd be orders of magnitude faster.

Cheers,
Jacob

@mbostock
Copy link
Member Author

I'm cleaning up some stalled pulled requests. I like the idea of optional CIE or Lab colorspace support you can pull in, but that could either be a d3.lab module (d3.lab.js?) or chromatist. Also I agree with @jrus that we could have better examples of how these colorspaces are used. Perhaps, for example, generating random categorical color scales with maximally-distinguishable colors?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants