Skip to content

[theme] Do not create channel tokens for custom colors when nativeColor is used#47765

Open
ZeeshanTamboli wants to merge 3 commits intomui:masterfrom
ZeeshanTamboli:theme-do-not-throw-error-for-custom-colors-issue-47740
Open

[theme] Do not create channel tokens for custom colors when nativeColor is used#47765
ZeeshanTamboli wants to merge 3 commits intomui:masterfrom
ZeeshanTamboli:theme-do-not-throw-error-for-custom-colors-issue-47740

Conversation

@ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Feb 14, 2026

Resolves comment #47740 (comment).

We do not create the channel tokens when nativeColor is used in theme. This is also mentioned in the docs: https://mui.com/material-ui/migration/upgrade-to-native-color/#remove-usage-of-channel-tokens.
This also avoids throwing the warning mentioned in the comment.


Before: https://stackblitz.com/edit/nze14hel-zah7msat?file=src%2FDemo.tsx
After: https://stackblitz.com/edit/nze14hel-cqrupmyz?file=src%2FDemo.tsx

@ZeeshanTamboli ZeeshanTamboli added type: bug It doesn't behave as expected. customization: theme Higher level theming customizability. labels Feb 14, 2026
@mui-bot
Copy link

mui-bot commented Feb 14, 2026

Netlify deploy preview

https://deploy-preview-47765--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+9B(0.00%) 🔺+5B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 1e37e86

codeCraft-Ritik

This comment was marked as spam.

// Do not create channel tokens when nativeColor is used.
if (!nativeColor) {
// MUI X - DataGrid needs this token.
setColorChannel(palette.background, 'default');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure how to handle this since MUI X is using some channel tokens.
https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/material/variables.ts#L31-L39

Copy link
Member Author

@ZeeshanTamboli ZeeshanTamboli Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will still generate the channel tokens when nativeColor is not used, right? So that means it will generate for MUI X, won't it?

@zannager zannager added the scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI label Feb 16, 2026
@ZeeshanTamboli ZeeshanTamboli added v7.x needs cherry-pick The PR should be cherry-picked to master after merge. labels Feb 16, 2026
@ZeeshanTamboli
Copy link
Member Author

Could this be reviewed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customization: theme Higher level theming customizability. needs cherry-pick The PR should be cherry-picked to master after merge. scope: system The system, the design tokens / styling foundations used across components. eg. @mui/system with MUI type: bug It doesn't behave as expected. v7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments