Skip to content

Use d50 referent instead of d65 for lab (and by extension hcl) color space#1

Draft
ChrisLoer wants to merge 1 commit intomainfrom
cloer/d50
Draft

Use d50 referent instead of d65 for lab (and by extension hcl) color space#1
ChrisLoer wants to merge 1 commit intomainfrom
cloer/d50

Conversation

@ChrisLoer
Copy link
Copy Markdown
Collaborator

I haven't updated the relevant tests yet, but the ones that are failing look like they're failing in ways that look about right, e.g.:

  ● interpolate › interpolate color › should interpolate colors in "lab" color space

    expect(received).toMatchObject(expected)

    - Expected  - 3
    + Received  + 3

      Object {
        "a": NumberCloseTo 0.9 (4 digits),
    -   "b": NumberCloseTo 0.7461000000000001 (4 digits),
    -   "g": NumberCloseTo 0.32084999999999997 (4 digits),
    -   "r": NumberCloseTo 0.3816 (4 digits),
    +   "b": 0.7501995807994258,
    +   "g": 0.3109760521913497,
    +   "r": 0.3567325378913688,

I also haven't figured out how to get this to properly build and incorporate into a maplibre-gl-js package yet.

cc @ibesora

Comment thread src/util/color_spaces.ts Outdated
const y = xyz2lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / Yn);
const z = xyz2lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / Zn);
let y, x, z;
y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "x, z;" do here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops -- nothing, I think. Left over from a different way of having the variables defined earlier.

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.

2 participants