-
Notifications
You must be signed in to change notification settings - Fork 91
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
[Color 4] JS API specs #1949
[Color 4] JS API specs #1949
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
I made this change in some places, but didn't do it for things like loops through channels. As is, I went from 580 cases to 1800+, but there may be other places where specificity is worth it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few style changes and I think we're ready to go!
js-api-spec/value/color.test.ts
Outdated
// Space conversions in ColorJS are close but not precise enough to match | ||
skipForImpl('sass-embedded', () => { | ||
describe('toSpace', () => { | ||
spaceNames.forEach(destinationSpaceId => { | ||
it(`converts pink to ${destinationSpaceId}`, () => { | ||
const destinationSpace = spaces[destinationSpaceId]; | ||
const res = color.toSpace(destinationSpace.name); | ||
expect(res.space).toBe(destinationSpace.name); | ||
|
||
const expected = destinationSpace.constructor( | ||
...destinationSpace.pink | ||
); | ||
expect(res).toEqualWithHash(expected); | ||
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nex3 Using ColorJS to do color conversions works, but the math isn't precise enough to pass these tests, e.g.:
expected color(xyz-d50 0.66406985168935 0.5367266828656 0.43459579340121) to be .equal() to color(xyz-d50 0.6640698533004 0.53672666252811 0.43459582467203)
I'm not sure if we want to relax the precision requirements, or have different precision requirements for different platforms, or...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved in d5d18b6
Spec: https://github.com/sass/sass/blob/main/proposal/color-4-new-spaces-js.d.ts.md
[skip dart-sass]
[skip sass-embedded]