Files
react-native/packages/normalize-color
Nick Gerleman 676359efd9 Breaking: Remove incorrect hwb() syntax support from normalize-color (#48912)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48912

The implementation of `hwb()` color functions added in https://github.com/facebook/react-native/pull/34600 is pretty flawed.

`hwb()` color functions do not allow comma delimited values. So most of the examples in the unit test here will fail to parse on web. Like `hsl()`, these should also allow numeric non-hue components (instead of just %), and angle values for hue (instead of just numbers), and this is also missing support for alpha values, though these are less dangerous compared to allowing and encouraging incorrect delimiters.

https://www.w3.org/TR/css-color-4/#the-hwb-notation

These were added for web compat, and the examples fail to parse on web, so I'm opting to just remove this incorrect support before implementing this more correctly in the Fabric CSS parser in next diff. I did not attempt to fix the other issues I discovered with the PR implementation in the last couple diffs, around mixing and matching syntax allowed in legacy/modern, along with allowing inconsistent delimiters.

Changelog:
[General][Breaking] - Remove incorrect hwb() syntax support from normalize-color

Reviewed By: lenaic

Differential Revision: D68591172

fbshipit-source-id: 36d670b096ae9fac4bc24938877ad083d4dd336a
2025-01-27 12:07:21 -08:00
..

@react-native/normalize-colors

Version

Installation

yarn add --dev @react-native/normalize-colors

Note: We're using yarn to install deps. Feel free to change commands to use npm 3+ and npx if you like

Testing

To run the tests in this package, run the following commands from the React Native root folder:

  1. yarn to install the dependencies. You just need to run this once
  2. yarn jest packages/normalize-color.