GithubHelp home page GithubHelp logo

Comments (3)

jsdario avatar jsdario commented on May 20, 2024

I'd really appreciate if you could attach a screenshot with some log, so I can appreciate which is your exact case.

We are using https://github.com/netbeast/colorsys to convert colors back and forward.

Highly saturated colors (whites) can be translated to red in some scenarios, since they lose their color information in (white in rgb is {255,255,255} but in hsv, hue is an independent variable, so its info is kept safe).

Don't know if that's the case of tinycolor, in colorsys there it is a test implementation:

https://github.com/netbeast/colorsys/blob/master/test/test.js#L39-L47

from react-native-color-wheel.

unmec avatar unmec commented on May 20, 2024

Thanks for your quick reply @jsdario

Actually I just found the reason and fixed it like this:

When dragging in that area, for instance at 7 o'clock blue color, picker returns a value like so:

{ h: -134.48844413341297, s: 87.99901795187165, v: 100 }

The correct range for h is [0, 360], so obviously tinycolor converting to hex will return some other colors like red (I was just logging the final result at the beginning).

All I did is a small check:

selected(color) {
  if (color.h < 0) {
    color.h = Number(color.h) + 360;
  }
  // do whatever I want with color
}

That's it. Hopefully it would be helpful for anyone else who is using this component.

from react-native-color-wheel.

jsdario avatar jsdario commented on May 20, 2024

Oh I see! Since I am collaborator here and in colorsys I considered hue as any possible valid angle in degrees.

Thanks a lot for your contribution! Will close the issue with a solved tag :)

from react-native-color-wheel.

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.