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 CIEDE2000 color distance #14

Merged
merged 11 commits into from
Jun 29, 2020

Conversation

pietroppeter
Copy link
Contributor

Hi,
this adds the functionality in https://github.com/pietroppeter/color_distance
I did a bit of cleanup of original code but not too much. Tests work fine.
I still have to add some documentation. I see that you are using mddoc and morepretty, I will try to use that.

@treeform
Copy link
Owner

This is looking good. I'll approve when you are ready.

Copy link
Owner

@treeform treeform left a comment

Choose a reason for hiding this comment

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

This is great. Thank you for adding this.

As you said running more/nimpretty and mrdoc will make it 100%.

let
C1 = sqrt(c1.a^2 + c1.b^2)
C2 = sqrt(c2.a^2 + c2.b^2)
CM = 0.5*(C1 + C2)
Copy link
Owner

Choose a reason for hiding this comment

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

0.5*(
I think there are some formatting things that nimpretty will fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was not fixed by nimpretty but I did it manually (I assume you imply spacing the '*')

else:
arctan2(x, y).radToDeg + 360

func deltaE00*(c1, c2: ColorLAB, k_L, k_C, k_H = 1.float32): float32 =
Copy link
Owner

Choose a reason for hiding this comment

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

k_L --> kL

Please follow Nim naming convention - no "_".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. I still have in that file some variable names that start with a Capital letter (although convention would want that only for types). Do you want me to adjust those too?

Copy link
Owner

Choose a reason for hiding this comment

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

Yes please.

src/chroma/distance.nim Outdated Show resolved Hide resolved
@pietroppeter pietroppeter marked this pull request as ready for review June 27, 2020 17:28
@pietroppeter
Copy link
Contributor Author

  • in the end I did not run morepretty (it is not on nimble packages), but at least I made sure exports and imports are manually sorted.
  • running mddoc on original chroma.nim makes appear a one hash function for each color space. API docs originally mentions only one and it seems reasonable to me, so I reverted that part.

@treeform
Copy link
Owner

I think this looks great merging.

@treeform treeform merged commit 7ec9565 into treeform:master Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants