You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[system] blend() returns wrong colors for hsl() and color() inputs #49753
scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUItype: bugIt doesn't behave as expected.
This is a pure function, so it can be reproduced without a live example:
import{blend}from'@mui/system';console.log(blend('#fff','hsl(0, 100%, 50%)',0.5));console.log(blend('#fff','color(srgb 1 0 0)',0.5));console.log(blend('#fff','rgb(255, 0, 0)',0.5));// same color as rgb, for comparison
Run the code above.
Compare the first two results with the third one.
Current behavior
The first call returns rgb(128, 178, 153) (a greenish grey) and the second returns rgb(128, 128, 128) (grey), while the rgb version returns rgb(255, 128, 128).
blend() takes the first three values of each decomposed color as rgb channels. For hsl() they are hue/saturation/lightness, and for color() they are in the 0-1 range, so the result is a wrong color with no warning.
Expected behavior
All three calls return rgb(255, 128, 128). Colors should be converted to rgb before blending, as getLuminance() already does for hsl colors.
Context
I was using blend() with theme colors defined in hsl. I have a fix with regression tests ready and will open a PR.
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@PANJA-ABHISHEK Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.
scope: systemThe system, the design tokens / styling foundations used across components. eg. @mui/system with MUItype: bugIt doesn't behave as expected.
Activity
github-actions commentedon Nov 24, 2026
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@PANJA-ABHISHEK Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.