Describe the bug
When having an application that has a nested ThemeProviders with the same theme and color modes but different values, toggling the colorMode changes the colorMode and theme in both the top level and nested theme provider, but when utilizing that theme in the nested component with the sx prop, the wrong colour gets applied.
To Reproduce
Here is a simple codesandbox that reproduces the issue. https://codesandbox.io/s/exciting-banzai-hrjom?file=/src/index.js
Expected behavior
In the example provided, I would expect the inner components background value for light mode to be "darkcyan", and it is if you print out the theme object. But when its applied to the div using sx={{ bg: "background" }} it applies "red".


Describe the bug
When having an application that has a nested ThemeProviders with the same theme and color modes but different values, toggling the colorMode changes the colorMode and theme in both the top level and nested theme provider, but when utilizing that theme in the nested component with the sx prop, the wrong colour gets applied.
To Reproduce
Here is a simple codesandbox that reproduces the issue. https://codesandbox.io/s/exciting-banzai-hrjom?file=/src/index.js
Expected behavior
In the example provided, I would expect the inner components background value for light mode to be "darkcyan", and it is if you print out the theme object. But when its applied to the div using
sx={{ bg: "background" }}it applies "red".