You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an unknown colorscheme is applied, the ThemeProvider falls back to a base theme, which is nice for ensuring a user sees something reasonable, but may not be the expected theme.
This behavior is a little hard to test for, since there's no property returned from useTheme describing which colorScheme is currently applied in the context.
This does console.error, however since themes can be provided at runtime it might be helpful to be able to determine which theme is currently applied in a given context.
Based on the above, the current way to do that seems like
A resolvedColorScheme property returned from useTheme, that returns which color scheme is actually active in a context might be a nice way to internalize that check and provide a nice way to validate that the correct them is applied from a consumer.
When an unknown colorscheme is applied, the ThemeProvider falls back to a base theme, which is nice for ensuring a user sees something reasonable, but may not be the expected theme.
This behavior is a little hard to test for, since there's no property returned from
useTheme
describing which colorScheme is currently applied in the context.for instance, gives a
useTheme
return ofbut when I pass an invalid colorScheme like
This does
console.error
, however since themes can be provided at runtime it might be helpful to be able to determine which theme is currently applied in a given context.Based on the above, the current way to do that seems like
A
resolvedColorScheme
property returned from useTheme, that returns which color scheme is actually active in a context might be a nice way to internalize that check and provide a nice way to validate that the correct them is applied from a consumer.The text was updated successfully, but these errors were encountered: