Skip to content

Commit

Permalink
[material-ui] Add paperChannel token (#41447)
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp authored Mar 11, 2024
1 parent be6c430 commit 9aec566
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mui-material/src/styles/CssVarsProvider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ describe('[Material UI] CssVarsProvider', () => {
paper: 'var(--mui-palette-background-paper)',
default: 'var(--mui-palette-background-default)',
defaultChannel: 'var(--mui-palette-background-defaultChannel)',
paperChannel: 'var(--mui-palette-background-paperChannel)',
}),
);
expect(screen.getByTestId('palette-action').textContent).to.equal(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export type Overlays = [

export interface PaletteBackgroundChannel {
defaultChannel: string;
paperChannel: string;
}

export interface PaletteCommonChannel {
Expand Down
3 changes: 3 additions & 0 deletions packages/mui-material/src/styles/experimental_extendTheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ export default function extendTheme(options = {}, ...args) {
// MUI X - DataGrid needs this token.
setColorChannel(palette.background, 'default');

// added for consistency with the `background.default` token
setColorChannel(palette.background, 'paper');

setColorChannel(palette.common, 'background');
setColorChannel(palette.common, 'onBackground');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ describe('experimental_extendTheme', () => {
expect(theme.colorSchemes.dark.palette.background.defaultChannel).to.equal('18 18 18');
expect(theme.colorSchemes.light.palette.background.defaultChannel).to.equal('255 255 255');

expect(theme.colorSchemes.dark.palette.background.paperChannel).to.equal('18 18 18');
expect(theme.colorSchemes.light.palette.background.paperChannel).to.equal('255 255 255');

expect(theme.colorSchemes.dark.palette.primary.mainChannel).to.equal('144 202 249');
expect(theme.colorSchemes.dark.palette.primary.darkChannel).to.equal('66 165 245');
expect(theme.colorSchemes.dark.palette.primary.lightChannel).to.equal('227 242 253');
Expand Down

0 comments on commit 9aec566

Please sign in to comment.