Skip to content

[theme] Rename type to mode#22687

Merged
mnajdova merged 6 commits into
mui:nextfrom
mnajdova:feat/theme-type-to-mode
Sep 22, 2020
Merged

[theme] Rename type to mode#22687
mnajdova merged 6 commits into
mui:nextfrom
mnajdova:feat/theme-type-to-mode

Conversation

@mnajdova

@mnajdova mnajdova commented Sep 21, 2020

Copy link
Copy Markdown
Member

Breaking changes

  • Renames theme.palette.type to theme.palette.mode, to better follow the "dark mode" term that is usually used for describing this feature.

    import { createMuiTheme } from '@material-ui/core/styles';
    
    -const theme = createMuitheme({palette: { type: 'dark' }}),
    +const theme = createMuitheme({palette: { mode: 'dark' }}),

    The changes are supported by the adaptV4Theme() for easing the migration


Part of #20012

@mui-pr-bot

mui-pr-bot commented Sep 21, 2020

Copy link
Copy Markdown

Details of bundle changes

Generated by 🚫 dangerJS against 9fba300

@mnajdova
mnajdova marked this pull request as ready for review September 21, 2020 17:41
@mnajdova mnajdova added the breaking change Introduces changes that are not backward compatible. label Sep 21, 2020
data-ga-event-category="header"
data-ga-event-action="dark"
>
{theme.palette.type === 'light' ? <Brightness4Icon /> : <Brightness7Icon />}

@mbrookes mbrookes Sep 21, 2020

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That reminds me (and completely incidental to this PR), but we should really provide an option to return to the browser / system setting. At the moment, once a cookie is set, the mode is fixed.

@mbrookes mbrookes added this to the v5 milestone Sep 22, 2020
Comment thread packages/material-ui/src/styles/adaptV4Theme.js Outdated

@oliviertassinari oliviertassinari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Comment thread docs/src/pages/guides/migration-v4/migration-v4.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants