Skip to content
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

Dark theme elevation feature overrides custom background colors #1075

Closed
rafaelbrier opened this issue Feb 20, 2021 · 2 comments · Fixed by #1079
Closed

Dark theme elevation feature overrides custom background colors #1075

rafaelbrier opened this issue Feb 20, 2021 · 2 comments · Fixed by #1079
Milestone

Comments

@rafaelbrier
Copy link

The SASS variable of some components are being overridden when using dark Theme.
image

  1. Look, the image shows a style ".dark-theme .rmd-toast" where the variable "--rmd-theme-background" are being set again for some reason.

  2. Below at the class ".dark-theme" i globally defined that variable.

  3. The code that i use for theme switch:

// Uses System Preference
@media (prefers-color-scheme: dark) {
    :root {
        @include rmd-theme-dark;
    }
}

@media (prefers-color-scheme: light) {
    :root {
        @include rmd-theme-light;
    }
}

// Class for global theme change
.dark-theme {
    @include rmd-theme-dark;
}

.light-theme {
    @include rmd-theme-light;
}

What is the expected behavior?

The variable should not be overridden in the dark theme.

A little about versions:
Windows
Chrome
"react-md": "^2.5.3"

@mlaursen mlaursen added this to the v2.6.1 milestone Feb 27, 2021
@mlaursen
Copy link
Owner

mlaursen commented Feb 27, 2021

Whoops, this was an unintended side-effect of using @mixin rmd-theme-dark-elevation-styles and @mixin rmd-theme-dark-elevation to implement the dark elevation styles. I'll introduce new SCSS variables to help solve this as well as reduce the specificity for the dark elevation styles.

This bug current affects:

  • @react-md/alert
  • @react-md/card
  • @react-md/dialog
  • @react-md/form (temporary Listbox only)
  • @react-md/menu
  • @react-md/sheet

@rafaelbrier
Copy link
Author

Thank you for the clarification! I'll disable the dark elevation for now.

@mlaursen mlaursen added the theme label Feb 27, 2021
@mlaursen mlaursen changed the title Problem with global variables and themes SASS Dark theme elevation feature overrides custom background colors Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants