Comments (3)
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.
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.
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)
- thumb
- recent commits have caused issues HOT 3
- not getting color change event HOT 1
- onColorChanged Not working HOT 1
- the Wheel is not the right size HOT 1
- Error PanResponder !!! HOT 2
- Help! Can I use this image? HOT 2
- Merge 'Invariant Violation fix' to npm library HOT 8
- Create value prop HOT 1
- Draggable thumb goes off the view HOT 5
- onColorChange returns negative hue value HOT 3
- Invarian Violation HOT 6
- Color wheel misbehaves when placed in flexbox View HOT 2
- Not working if it is used multiple times HOT 2
- malformed calls from js field sizes are different HOT 2
- Change color to kelvin HOT 1
- Multiple select spots HOT 1
- absX in measureOffset() is not reliable? HOT 2
- onChange is undefined
- Sliding along the boundaries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-color-wheel.