GithubHelp home page GithubHelp logo

LUV and XYZ. about d3-color HOT 11 OPEN

d3 avatar d3 commented on April 24, 2024
LUV and XYZ.

from d3-color.

Comments (11)

mbostock avatar mbostock commented on April 24, 2024 5

Okay. I think I’ll just keep everything existing as-is, improve the documentation, and introduce:

  • d3.luv = CIELUV
  • d3.lchuv = CIELCh_uv
  • d3.xyz = CIEXYZ

from d3-color.

mbostock avatar mbostock commented on April 24, 2024 2

I’m leaning towards the names d3.lab (CIELAB), d3.luv (CIELUV), d3.xyz (CIEXYZ), d3.lchab (CIELCh_ab), d3.lchuv (CIELCh_uv), and the corresponding d3.interpolate* methods (though I’m not sure I’ll bother with d3.interpolateXyz, as I’m only exposing d3.xyz for people that are interested in the internals of the CIE color spaces).

This would deprecate both d3.lch and d3.hcl in favor of d3.lchab.

How does that sound?

from d3-color.

jrus avatar jrus commented on April 24, 2024 1

should redefine d3.hcl as polar CIELUV

Please don’t do this; it is horrendously confusing. Use names like d3.cieluv_hcl or d3.cielab_lch if you want. Personally I would strongly recommend using the same input order for both. Just because R has picked a bad convention doesn’t mean it should be widely copied.

The names ‘HCL’ and ‘LCH’ have no standard meaning. (Aside: usually the “h” is written in lower case in color science literature; it’s not exactly clear why. So people often write LCh or similar.)

(It IMO also doesn’t really ever make sense to use CIELUV or XYZ in data visualizations. If you add these, you might want to warn people away from using them.)

from d3-color.

Enteleform avatar Enteleform commented on April 24, 2024 1

@mbostock

Okay. I think I’ll just keep everything existing as-is, improve the documentation, and introduce:

  • d3.luv = CIELUV
  • d3.lchuv = CIELCh_uv
  • d3.xyz = CIEXYZ

Please also include the d3.lchab (CIELCh_ab) alias that you mentioned in your earlier proposition.

This will provide explicitness & result in more easily understandable code for those who use both lchab and lchuv spaces, without requiring knowledge of the historical implementations/defaults of the library.

from d3-color.

mbostock avatar mbostock commented on April 24, 2024 1

Per #84 and #51, sounds like we’d want two or possibly three for XYZ due to the choice of illuminants.

So, I think this is the latest list?

  • d3.luv = CIELUV
  • d3.lchab = CIELCh_ab
  • d3.lchuv = CIELCh_uv
  • d3.xyzd65 = XYZ D65
  • d3.xyzd50 = XYZ D50
  • d3.lch = alias for d3.lchab
  • d3.hcl = alias for d3.lchab with arguments in reverse order
  • d3.xyz = alias for d3.xyzd65?

from d3-color.

mbostock avatar mbostock commented on April 24, 2024

https://observablehq.com/@mbostock/luv-and-hcl

from d3-color.

jrus avatar jrus commented on April 24, 2024

Aside: While CIELUV doesn’t really have any practical purpose nowadays, the (u′, v′) chromaticity diagram does continue to be useful, superior to the (x, y) chromaticity diagram.

from d3-color.

gka avatar gka commented on April 24, 2024

Wouldn't it be easier for everyone if d3.lch would just continue to exist as d3.lchab alias?

from d3-color.

mbostock avatar mbostock commented on April 24, 2024

I’m only planning on deprecating, not removing. We could keep d3.lch (non-deprecated) as CIELCh_ab, but the point is that it would be ambiguous and inconsistent if we also have CIELCh_uv as d3.lchuv. Though if CIELCh_ab is the “recommended” CIELCh, then it might make sense to leave it as d3.lch…

from d3-color.

jrus avatar jrus commented on April 24, 2024

That sounds clearer. If you use lch as an alias for CIELAB LCh that is also generally not too bad, as CIELAB is very widely used. I was mostly worried about is confusion of lch vs. hcl meaning totally different things.

from d3-color.

svgeesus avatar svgeesus commented on April 24, 2024

Sorry, only just noticed this. @jrus wrote:

(Aside: usually the “h” is written in lower case in color science literature; it’s not exactly clear why. So people often write LCh or similar.)

This is because h is an angular measure, and in color difference formulae which start from LChab (starting with ΔE CMC, then ΔE 94 and ΔE2000) h is turned into a length measure H by calculating the length of the angular arc, which involved the (mean) Chroma and the hue angle. It then makes sense to add it's square to the squares of the Chroma and Lightness lengths.

So h vs. H solves the "which H are we talking about here" and is mainly interesting to people discussing the implementation details of color differences; for everyone else (especially people already using H in HSL to mean an angular measure) LCH seemed just fine, which is why CSS Color 4 used that.

from d3-color.

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.