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

Feature Ideas #11

Open
jlarmstrongiv opened this issue Jul 21, 2019 · 6 comments
Open

Feature Ideas #11

jlarmstrongiv opened this issue Jul 21, 2019 · 6 comments

Comments

@jlarmstrongiv
Copy link

Features

Perceptual Distance

I like this library a lot! However, by using the pure and numerical RGB approach, this library does not calculate the closest color according to human perception.

It would be great to support a custom distance algorithm, such as one from DeltaE.

.nearestColors() // returns array

Also, if this library is used to present colors to the user, it may be beneficial to present say, the top five closest colors. Or, perhaps re-order the entire color array according to closest distance.

Custom color dictionaries

I am working with color dictionaries (aka Pantone) that define multiple properties of colors. For instance, it uses array of colors that look like:

// CMYK
    {
      "name": "3514 UP",
      "model": "CMYK",
      "color": [
        0,
        0.20000000298023224,
        1,
        0
      ],
      "type": "normal"
    },
// RGB
        {
          "name": "3514 UP",
          "model": "RGB",
          "color": [
            0.9529411792755127,
            0.7019608020782471,
            0.23137255012989044
          ],
          "type": "normal"
        },

There are many types of color formats as well. Chroma.js supports many of these color formats.

It would be great to support passing in a colors array of objects, and specifying the key where the color could be found.

Implementation Intricacies

The trouble is that different distance calculators require different color modes. For example, the current distance calculator in this library uses hex codes. The DeltaE distance calculator uses Lab colors.

I think the user should be responsive for providing the right format for the right distance calculator. That way, the user could cache the results of color converting RGB => Hex or RGB => Lab (etc).

Using color dictionaries would allow users to save the pre-computed results of those color conversions within the colors array itself. For instance, when nearestColor() is called multiple times, it knows the key/path of the pre-computed color and saves time. Thus, the user (not this library) will choose its preferred way of converting colors and caching them.

These ideas may necessitate a V2 of the nearest-color package. However, it will add beneficial features. What do you think? If nearest-color isn’t the right package for these features, please let me know, and I’ll create a different package.

@remjx
Copy link

remjx commented Apr 12, 2020

hi @jlarmstrongiv, have you found a different solution that incorporates these features? Or still just ideas at this point?

@jlarmstrongiv
Copy link
Author

Happy Easter 🐣@markjackson02 Unfortunately, I haven’t found any alternative solutions. Just ideas at this point. Personally, I’m building on a little color web app and haven’t worked on that feature yet

@heyaco
Copy link

heyaco commented Jul 4, 2020

@jlarmstrongiv did you get to implementing these ideas yet? I know it's only been a few months but I like your ideas and would like to apply them :)

@jlarmstrongiv
Copy link
Author

Hi @starkana While I created an mvp for the color app, I ran out of time to include this feature. I would love to work on the project more, but I am in need of finding a job. After that, there’s a good chance it’ll be my weekend project :)

@t0mpr1c3
Copy link

t0mpr1c3 commented Feb 3, 2023

@t0mpr1c3
Copy link

t0mpr1c3 commented Feb 3, 2023

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

No branches or pull requests

4 participants