-
Notifications
You must be signed in to change notification settings - Fork 14
Use colorjs.io to represent CSS4 colors.
#1975
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: a8b12ee The changes in this PR will be included in the next version bump. This PR includes changesets to release 80 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| const serialize = serializer(Gradient.Linear.parse); | ||
|
|
||
| const red = color(1, 0, 0); | ||
| const lime = color(0, 1, 0); |
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.
Remark: Tests that used green now switch to lime. This is because lime is #00FF00, or rgb(0% 100% 0%) while green is #008000, or rgb(0% 50.19607843137255% 0%) (128/255). For the sake of avoiding messy floating point arithmetic in tests, lime is just simpler…
| * The old `RGB`, `Named`, `Hex`, … classes no longer exist. Everything is bundled into a `CC4Color` class. The `#red`, `#green`, `#blue`, `#alpha` getters still exist, returning the components in the sRGB color space. | ||
| * The constructors `Color.hsl`, `Color.hex`, … have similarly been removed. | ||
| * The `Color.rgb` constructor has been kept as it is used in many places. |
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.
This will require changes in Dory which is using RGB.of in a few places, notably when building oracles and when marshalling color related diagnostics.
RGB.of will need to be replaced by Color.rgb. The RGBtoColorJSON helper will also need some adaptation, but that should be simplification since the sRGB components are now guaranteed to be Percentage (cannot be Number anymore).
@mvy-siteimprove FYI.
| 1: Outcomes.IsDistinguishable( | ||
| [style, Err.of(spanStyle)], | ||
| [addCursor(Ok.of(spanStyle)), addCursor(style)], | ||
| [addCursor(style), addCursor(Ok.of(spanStyle))], |
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.
I believe the swapping of elements was already present, but simpler color representation made .deepEqual able to ignore it 🤔
|
!pr extract |
Prepare for #1966