Skip to content

Support Alpha Channel in HWB Color for React Native 0.79.0 #50583

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

Closed
alabsi91 opened this issue Apr 9, 2025 · 3 comments
Closed

Support Alpha Channel in HWB Color for React Native 0.79.0 #50583

alabsi91 opened this issue Apr 9, 2025 · 3 comments
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: Fixed A PR that fixes this issue has been merged.

Comments

@alabsi91
Copy link

alabsi91 commented Apr 9, 2025

Description

React Native 0.79.0 introduced support for the modern HWB color format, aligning with the W3C CSS Color Module Level 4 specification. However, the current implementation lacks support for the alpha channel.

syntax: hwb(hue whiteness% blackness% / alpha).

Steps to reproduce

Define a style that uses an HWB color with an alpha channel, e.g.:

const styles = StyleSheet.create({
  container: {
    backgroundColor: 'hwb(200 30% 20% / 0.5)', 
  },
});

Expected Behavior
The backgroundColor property should render the view with the correct HWB color and transparency (e.g., hwb(200 30% 20% / 0.5) as a semi-transparent blue).

Actual Behavior
The color is ignored.

React Native Version

0.79.0

Affected Platforms

Runtime - iOS

Output of npx @react-native-community/cli info

//

Stacktrace or Logs

//

Reproducer

//

Screenshots and Videos

No response

@react-native-bot react-native-bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Apr 9, 2025
@react-native-bot
Copy link
Collaborator

Warning

Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

@cortinico
Copy link
Contributor

cc @NickGerleman

@NickGerleman
Copy link
Contributor

Modern parsing stack correctly supports this, but is not shipped yet.

constexpr std::optional<CSSColor> parseCSSColorFunction(

PRs welcome for fixes to the “processColor” stack referenced in the above PR. The code to support “modern color syntax” and hwb functions there has been around since RN 0.71, but it has plenty of missing support and bugs.

@cortinico cortinico added the Resolution: Fixed A PR that fixes this issue has been merged. label Apr 17, 2025
uffoltzl pushed a commit to uffoltzl/react-native that referenced this issue Apr 18, 2025
Summary:
Fixes facebook#50583. cc NickGerleman

## Changelog:

[GENERAL] [FIXED] - CSS Added hwb(H W B / A) notation

Pull Request resolved: facebook#50750

Test Plan: Added hwb(H W B / A) notation

Reviewed By: cipolleschi

Differential Revision: D73126316

Pulled By: NickGerleman

fbshipit-source-id: 8e3730c6de44a0b4d8a21339e1f7339cb70e2044
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: Fixed A PR that fixes this issue has been merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants