Comments (8)
There have been a number of PRs regarding this in the past, Actually, no there haven't. That constant's been there since the package was first created.
Do you have some reference for the (6/29)^3
figure? I'm not an expert with lab/xyz.
If this is truly the case, happy to accept a PR that constructs the constant at boot time and uses that instead of the hardcoded value.
from color-convert.
Ah actually that's pretty well documented. Neat, thanks for the heads up. Will fix.
from color-convert.
c1576fe should fix it; as for the other constants, I'm not sure they can be adjusted based on some cursory research. Further, some of the more specific ones are hitting limits of the IEEE standard anyway.
Let me know if that's adequate or if any others should be calculated like that. If not, I'll cut a release for you.
Thanks again!
from color-convert.
Wow, thanks for the quick fix! Could you also change 7.787 to 1/3*(4/29)^(-2) (ref: lab wiki) ?
rgb to xyz is also inaccurate based on my manual testing, but I'm still figuring out what needs to be changed.
One other thing is that any reason there are no tests broken?
from color-convert.
The tests are using the default (rounded) versions of calls. Probably best, anyway, given IEEE inaccuracies, especially at such a fine-grained level.
from color-convert.
The change you requested gives me a drastically different result (**
is the power operator here):
> 1/3*(4/29)**-2
17.520833333333332
Am I misunderstanding the formula? I would have expected it to be mostly the same, if not a bit more precise.
from color-convert.
Sorry. Typo. 1/3*(6/29)^(-2)
Reference: https://en.m.wikipedia.org/wiki/CIELAB_color_space
from color-convert.
Too lazy to figure out what's wrong with rgb to xyz. Feel free to close this once 1/3*(6/29)^(-2) is fixed.
Things I used for manual testing the convertion:
To document my findings for rgb to xyz conversion:
For #FABD2F
, both external tool produced xyz: 58.139, 56.929, 10.615 (with rounding)
While color-convert produced: 58.13502713482779, 56.924421562846604, 10.61278897125713
I don't think it's too fine grained though. My library converts rgb to lab color space, do some basic arithmetic and then convert back to 0-255 integer version of rgb. And some rgb components is off by 2. Too lazy to write a minimum example though.
If you are worried about IEEE inaccuracy, maybe set a difference threshold when asserting. Threshold of 1 is not justified just to account for IEEE inaccuracy. But not a high priority though.
from color-convert.
Related Issues (20)
- Convertation is differrent HOT 1
- Update module color-name version HOT 1
- Is this library still maintained? HOT 3
- Changelog/release notes for 2.0.0 or 2.0.1?
- [Question] Why do the LCH and LAB conversion results differ from those on Chrome? HOT 1
- add useful constants / scales HOT 2
- can this library provide conversion to xyY color space as well HOT 2
- Failure to convert XYZ to RGB and back HOT 2
- hsla support? HOT 1
- 下载taro-ui出错,这跟node-sas是有什么关系
- convert.rgb.hex(250,0,0) = FA0000 ??? HOT 1
- Failure to convert RGB to HSL and back HOT 1
- different Copyright Information in LICENSE and README file HOT 1
- ansi256 => ansi16 squashes a bunch of grayscale values and basic colors to black HOT 7
- Move to Actions
- Add ansi256->ansi16 short circuit
- Can this library provide conversion of color to xyY color space as well?? HOT 2
- Incorrect conversion RGB to HSV HOT 1
- hsl.hex returns incorrect result.
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 color-convert.